Win10测试用BINDEVENT()没截获到WM_POWERBROADCAST消息
测试代码:
DECLARE LONG SetSuspendState IN PowrProf.dll LONG, LONG, LONG
#DEFINE WM_POWERBROADCAST 0x0218
#DEFINE PBT_APMRESUMEAUTOMATIC 0x12
of = CREATEOBJECT("myForm")
of.show(1)
RETURN
DEFINE CLASS myForm as Form
ADD OBJECT cmd1 as commandbutton WITH top=10,left=10,height=22,caption="挂起"
ADD OBJECT cmd2 as commandbutton WITH top=10,left=120,height=22,caption="休眠"
ADD OBJECT edit1 as editbox WITH top=40,left=10,height=200,width=200
PROCEDURE init
BINDEVENT(this.hWnd, WM_POWERBROADCAST, this, "powerbroadcast")
ENDPROC
PROCEDURE cmd1.click
SetSuspendState(0,0,0)
ENDPROC
PROCEDURE cmd2.click
SetSuspendState(1,0,0)
ENDPROC
PROCEDURE powerbroadcast(hWnd, uMsg, wParam, lParam)
this.edit1.seltext = "Msg:"+TRANSFORM(uMsg)+" Param:"+TRANSFORM(wParam)+0h0D0A
ENDPROC
ENDDEFINE