掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
時刻の設定方法は? (ID:23950)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
試してませんが http://www.swissdelphicenter.ch/en/showcode.php?id=90を参考に。 const SE_SYSTEMTIME_NAME = 'SeSystemtimePrivilege'; var hToken: THandle; ReturnLength: DWORD; tkp, PrevTokenPriv: TTokenPrivileges; luid: TLargeInteger; dSysTime: TSystemTime; begin if (Win32Platform = VER_PLATFORM_WIN32_NT) then begin if OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then begin try if not LookupPrivilegeValue(nil, SE_SYSTEMTIME_NAME, luid) then Exit; tkp.PrivilegeCount := 1; tkp.Privileges[0].luid := luid; tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED; if not AdjustTokenPrivileges(hToken, False, tkp, SizeOf(TTOKENPRIVILEGES), PrevTokenPriv, ReturnLength) then Exit; if (GetLastError <> ERROR_SUCCESS) then begin raise Exception.Create(SysErrorMessage(GetLastError)); Exit; end; finally CloseHandle(hToken); end; end; end; GetLocalTime(dSysTime); dSysTime.wHour := strToint(EditHour.text); dSysTime.wMinute := strToint(EditMinutes.text); dSysTime.wMilliseconds := strToint(EditSecond.text); Windows.SetLocalTime(dSysTime); end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.