whitegod 发表于 2009-5-31 00:38:01

利用DLLCALL调用Sendmessage关闭monitor的不解之处

本帖最后由 whitegod 于 2009-5-31 02:17 编辑

Local $HWND = WinGetHandle("classname=Progman")
    Switch StringUpper($io_control)
      Case "OFF"
          DllCall("user32.dll", "int", "SendMessage", "hwnd",$HWND, "int","274", "int", "61808", "int", 2)

   上面的代码可以关闭显示器.从原理上来讲,应该是让VGA不输出信号来实现的.为什么在调用Sendmessage API的时候, 用276,61808,2 这三个整形呢,这个问题,我查了很多资料,还是没法解答,哪位高手可以源源本本的将这个问题说一下呀,小弟不胜感激.
    各位也可加我QQ:250959705

sensel 发表于 2009-5-31 01:25:27

SendMessage(hwnd, WM_SYSCOMMAND, SC_MONITORPOWER,1)

Winuser.h
#define WM_SYSCOMMAND                   0x0112
#define SC_MONITORPOWER 0xF170

google SC_MONITORPOWER

sensel 发表于 2009-5-31 01:28:04

补充:
http://msdn.microsoft.com/en-us/library/ms646360(VS.85).aspx

SC_MONITORPOWER
Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
The lParam parameter can have the following values:

-1 - the display is powering on
1 - the display is going to low power
2 - the display is being shut off

whitegod 发表于 2009-5-31 02:14:02

sensel,Thank you very much.

zjg2003 发表于 2009-5-31 09:27:43

msdn耶,都是高手哦

acetaohai123 发表于 2011-12-7 14:02:08

学习了,很好

gp2386 发表于 2012-5-8 14:49:57

学习了3l~
页: [1]
查看完整版本: 利用DLLCALL调用Sendmessage关闭monitor的不解之处