1月 172013
 

注意:
1. 使用WM_SYSCOMMAND时,鼠标的一些消息可能会受到影响,比如不能响应MouseUp事件,可以在窗口中捕获WM_SYSCOMMAND消息,并判断消息的CommandType来判断消息执行完毕的情况

SC_CLOSE 关闭窗口
SC_HOTKEY Activate the window associated with the application-specified hot key.
SC_HSCROLL Scroll horizontally.
SC_KEYMENU Retrieve a menu through a keystroke.
SC_MAXIMIZE 最大化窗口
SC_MINIMIZE 最小化窗口.
SC_MOUSEMENU Retrieve a menu through a mouse click.
SC_MOVE Move the window.
SC_NEXTWINDOW Move to the next window.
SC_PREVWINDOW Move to the previous window.
SC_RESTORE Save the previous coordinates (checkpoint).
SC_SCREENSAVE 激活屏幕保护程序.
SC_SIZE Size the window.
SC_TASKLIST 激活开始菜单.
SC_VSCROLL Scroll vertically.
SC_MONITORPOWER 关闭显示器(LPARAM为非0参数)
SC_SEPARATOR
SC_CONTEXTHELP 显示帮助
SC_DEFAULT

SC_SIZE = $F000
SC_MOVE = $F010
SC_MINIMIZE = $F020
SC_MAXIMIZE = $F030
SC_NEXTWINDOW = $F040
SC_PREVWINDOW = $F050
SC_CLOSE = $F060
SC_VSCROLL = $F070
SC_HSCROLL = $F080
SC_MOUSEMENU = $F090
SC_KEYMENU = $F100
SC_ARRANGE = $F110
SC_RESTORE = $F120
SC_TASKLIST = $F130
SC_SCREENSAVE = $F140
SC_HOTKEY = $F150
SC_DEFAULT = $F160
SC_MONITORPOWER = $F170
SC_CONTEXTHELP = $F180
SC_SEPARATOR = $F00F
有的时候我们看到一些这里没有的命令,比如用鼠标拖动控件时用的panel1.Perform(WM_SYSCOMMAND, $F012, 0);这个$F012这个命令在定义里没有,其实它是SC_MOVE or 2的结果,微软的文档中提到WM_SYSCOMMAND命令中wParam的值的低4位值是保留的。
举例说明:
在Form的MouseDown事件里写如下代码
ReleaseCapture;
Perform(WM_SYSCOMMAND, SC_SIZE OR 1, 0); // Left
Perform(WM_SYSCOMMAND, SC_SIZE OR 2, 0); // Right
Perform(WM_SYSCOMMAND, SC_SIZE OR 3, 0); // Top
Perform(WM_SYSCOMMAND, SC_SIZE OR 4, 0); // left-top
Perform(WM_SYSCOMMAND, SC_SIZE OR 5, 0); // Right-top
Perform(WM_SYSCOMMAND, SC_SIZE OR 6, 0); // bottom
Perform(WM_SYSCOMMAND, SC_SIZE OR 7, 0); // left-bottom
Perform(WM_SYSCOMMAND, SC_SIZE OR 8, 0); // right-bottom

Share Button
打赏

 发表评论

你可以使用下列HTML标签和属性:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

* Copy This Password *

* Type Or Paste Password Here *

8,693迄今阻止垃圾评论Spam Free Wordpress