절전모드를 막을수 있는 루틴이라는데요....
제가 C++언어는 잘몰라서요...
C++좀 할줄아시는분 델파이로 변환좀 부탁드립니다.
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
...
//}}AFX_MSG_MAP
ON_MESSAGE(WM_POWERBROADCAST, OnPowerBroadcast)
END_MESSAGE_MAP()
/*
PBT_APMBATTERYLOW Battery power is low.
PBT_APMOEMEVENT OEM-defined event occurred.
PBT_APMPOWERSTATUSCHANGE Power status has changed.
PBT_APMQUERYSUSPEND Request for permission to suspend.
PBT_APMQUERYSUSPENDFAILED Suspension request denied.
PBT_APMRESUMEAUTOMATIC Operation resuming automatically after event.
PBT_APMRESUMECRITICAL Operation resuming after critical suspension.
PBT_APMRESUMESUSPEND Operation resuming after suspension.
PBT_APMSUSPEND System is suspending operation
*/
LRESULT CMainFrame::OnPowerBroadcast(WPARAM dwPowerEvent, LPARAM dwData)
{
if (dwPowerEvent == PBT_APMQUERYSUSPEND)
return BROADCAST_QUERY_DENY;
else
return TRUE;
}
ㅈ
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure AppMessage(var Msg: TMsg; var Handled: Boolean);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TForm1 }
{ TForm1 }
procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
if (Msg.Message = WM_POWERBROADCAST) and
(Msg.wParam = PBT_APMQUERYSUSPEND) then
begin
Handled := false;
end
else begin
Handled := true;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;
end.