unit Unitapm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
APM, ExtCtrls;
const
PBT_APMQUERYSUSPEND = 0; {Request for permission to suspend.}
PBT_APMQUERYSUSPENDFAILED = 2; {Suspension request denied.}
PBT_APMSUSPEND = 4; {System is suspending operation.}
PBT_APMRESUMECRITICAL = 6; {Operation resuming after critical suspension.}
PBT_APMRESUMESUSPEND = 7; {Operation resuming after suspension.}
PBT_APMBATTERYLOW = 9; {Battery power is low.}
PBT_APMPOWERSTATUSCHANGE = 10; {Power status has changed.}
PBT_APMOEMEVENT = 11; {OEM-defined event occurred.}
type
TForm1 = class(TForm)
procedure WMPOWER( var Message: TMessage); message WM_POWER;
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure doWinampCommand( const i1: integer);
var
h: integer;
begin
h := FindWindow('Winamp v1.x', nil);
sendMessage(h, WM_COMMAND, i1, 0);
end;
procedure SysFoucs(hWnd:integer);
begin
setfocus(hWnd);
SetwindowPos(hwnd,HWND_BOTTOM,0,0,0,0,0);
end;
procedure TForm1.WMPOWER( var Message: TMessage);
var hWnd:integer;
begin
case Message.WParam of
PWR_SUSPENDREQUEST: Message.Result := PWR_FAIL;
else defaultHandler( Message);
end;
doWinampCommand(40048);
hWnd:=FindWindow(pchar('#32770'),nil);
SysFoucs(hWnd);
keybd_event(Ord(13), 0, 0, 0);
end;
end.