Registriert seit: 4. Apr 2008
400 Beiträge
|
Re: Windows 7 Standby/Hibernate Phänomen
21. Nov 2009, 19:37
Danke!
Habe es einmal so versucht:
Delphi-Quellcode:
procedure RegisterPowerSettingNotification(hRecipient : hwnd; PowerSettingGuid: PGuid; Flags: byte);stdcall;external 'user32.dll';
Procedure RegisterForPowerNotifications(hwnd: hwnd);
Const
GUID_POWERSCHEME_PERSONALITY: TGUID = '{245d8541-3943-4422-b025-13A784F679B7}';
GUID_MIN_POWER_SAVINGS: TGUID = '{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}';
GUID_MAX_POWER_SAVINGS: TGUID = '{a1841308-3541-4fab-bc81-f71556f20b4a}';
GUID_TYPICAL_POWER_SAVINGS: TGUID = '{381b4222-f694-41f0-9685-ff5bb260df2e}';
GUID_ACDC_POWER_SOURCE: TGUID = '{5d3e9a59-e9D5-4b00-a6bd-ff34ff516548}';
GUID_BATTERY_PERCENTAGE_REMAINING: TGUID = '{a7ad8041-b45a-4cae-87a3-eecbb468a9e1}';
GUID_IDLE_BACKGROUND_TASK: TGUID = '{515c31d8-f734-163d-a0fd-11a08c91e8f1}';
GUID_SYSTEM_AWAYMODE: TGUID = '{98a7f580-01f7-48aa-9c0f-44352c29e5C0}';
GUID_MONITOR_POWER_ON: TGUID = '{02731015-4510-4526-99e6-e5a17ebd1aea}';
Var
DEVICE_NOTIFY_WINDOW_HANDLE: Byte;
Begin
DEVICE_NOTIFY_WINDOW_HANDLE := 0;
RegisterPowerSettingNotification(hwnd,
@GUID_POWERSCHEME_PERSONALITY,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_MIN_POWER_SAVINGS,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_MAX_POWER_SAVINGS,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_TYPICAL_POWER_SAVINGS,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_ACDC_POWER_SOURCE,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_BATTERY_PERCENTAGE_REMAINING,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_IDLE_BACKGROUND_TASK,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_SYSTEM_AWAYMODE,
DEVICE_NOTIFY_WINDOW_HANDLE);
RegisterPowerSettingNotification(hwnd,
@GUID_MONITOR_POWER_ON,
DEVICE_NOTIFY_WINDOW_HANDLE);
End;
Jedoch auch keine Meldung zu meinem Fenster das ich mit AllocateHWnd mache
Hast du vielleicht einen Tipp wo du das gefunden hast?
Delphi 2010, Update 4 & 5
|
|
Zitat
|