L
lvjjx
Unregistered / Unconfirmed
GUEST, unregistred user!
; ;我今天在编程的时候发现了一个问题,自己想不通。因为听别人说你也是用delphi编程序的,所以想问问你。
; ; 我的问题就是如何捕获最小化消息。我自己写的一段代码行不通,但是我的一张光盘上的一个源程序却可以。
--------------my code-----------------
函数声明:
procedure CaptureSYSCOMMAND(var msg:TMsg);message WM_SYSCOMMAND;
procedure TForm1.CaptureSYSCOMMAND(var msg:TMsg);
begin
; ; ;inherited;
; ; ;if msg.wParam=SC_MINIMIZE then
begin
; ; ; ; ; ; ;//处理程序
; ; ; ; end;
end;
-----------------------------------
////////////////////////sample code//////////////////////////////////
函数声明:
procedure capture(var msg:TWMSYSCOMMAND);message WM_SYSCOMMAND;
procedure TForm1.capture(var msg:TWMSYSCOMMAND);
begin
inherited;
; ; ;if msg.uCmdType=SC_MINIMIZE then
; ;begin
; ; ; ; ; ; ;//处理程序
; ; ; ; end;
end;
/////////////////////////////////////////////////////////////////////
; ; ; ; ; ; ; ; ; ;
但是我查过delphi带的Win32 Programmer's Reference里面有关于WM_SYSCOMMAND的一段说明
WM_SYSCOMMAND ;
uCmdType = wParam; ; ; ; ;// type of system command requested
xPos = LOWORD(lParam); ; ;// horizontal postion, in screen coordinates
yPos = HIWORD(lParam); ; ;// vertical postion, in screen coordinates
;
Parameters
uCmdType
Specifies the type of system command requested. This can be one of these values:
Value Meaning
SC_CLOSE Closes the window.
SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.
SC_DEFAULT Selects the default item; the user double-clicked the window menu.
SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.
SC_HSCROLL Scrolls horizontally.
SC_KEYMENU Retrieves the window menu as a result of a keystroke.
SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.
SC_MINIMIZE (or SC_ICON) Minimizes the window.
SC_MONITORPOWER Windows 95 only: Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
SC_MOUSEMENU Retrieves the window menu as a result of a mouse click.
SC_MOVE Moves the window.
SC_NEXTWINDOW Moves to the next window.
SC_PREVWINDOW Moves to the previous window.
SC_RESTORE Restores the window to its normal position and size.
SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE Sizes the window.
SC_TASKLIST Executes or activates Windows Task Manager.
SC_VSCROLL Scrolls vertically.
为什么着两种方法不等价?谢谢![]
; ; 我的问题就是如何捕获最小化消息。我自己写的一段代码行不通,但是我的一张光盘上的一个源程序却可以。
--------------my code-----------------
函数声明:
procedure CaptureSYSCOMMAND(var msg:TMsg);message WM_SYSCOMMAND;
procedure TForm1.CaptureSYSCOMMAND(var msg:TMsg);
begin
; ; ;inherited;
; ; ;if msg.wParam=SC_MINIMIZE then
begin
; ; ; ; ; ; ;//处理程序
; ; ; ; end;
end;
-----------------------------------
////////////////////////sample code//////////////////////////////////
函数声明:
procedure capture(var msg:TWMSYSCOMMAND);message WM_SYSCOMMAND;
procedure TForm1.capture(var msg:TWMSYSCOMMAND);
begin
inherited;
; ; ;if msg.uCmdType=SC_MINIMIZE then
; ;begin
; ; ; ; ; ; ;//处理程序
; ; ; ; end;
end;
/////////////////////////////////////////////////////////////////////
; ; ; ; ; ; ; ; ; ;
但是我查过delphi带的Win32 Programmer's Reference里面有关于WM_SYSCOMMAND的一段说明
WM_SYSCOMMAND ;
uCmdType = wParam; ; ; ; ;// type of system command requested
xPos = LOWORD(lParam); ; ;// horizontal postion, in screen coordinates
yPos = HIWORD(lParam); ; ;// vertical postion, in screen coordinates
;
Parameters
uCmdType
Specifies the type of system command requested. This can be one of these values:
Value Meaning
SC_CLOSE Closes the window.
SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.
SC_DEFAULT Selects the default item; the user double-clicked the window menu.
SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.
SC_HSCROLL Scrolls horizontally.
SC_KEYMENU Retrieves the window menu as a result of a keystroke.
SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.
SC_MINIMIZE (or SC_ICON) Minimizes the window.
SC_MONITORPOWER Windows 95 only: Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
SC_MOUSEMENU Retrieves the window menu as a result of a mouse click.
SC_MOVE Moves the window.
SC_NEXTWINDOW Moves to the next window.
SC_PREVWINDOW Moves to the previous window.
SC_RESTORE Restores the window to its normal position and size.
SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE Sizes the window.
SC_TASKLIST Executes or activates Windows Task Manager.
SC_VSCROLL Scrolls vertically.
为什么着两种方法不等价?谢谢![]