热情软件屋

 

如何截取最小化按钮或恢复按钮被按下的消息


编号:QA001879
建立日期: 1999年10月20日 最后修改日期:1999年10月20日
所属类别:

杨树叶子:
    Visual C++5.0
    Windows 95
    请问我如何截取最小化按钮或恢复按钮被按下的消息,WM_SIZE是在窗口被改变尺寸后才发送的,现在我想在窗口尺寸被改变之前进行自已的处理,然后才决定是否交由系统将窗口最小化或最大化,该如何做呢?请不吝赐教,此致衷心感谢!

回答:

    你应该截取 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
    其中uCmdType表示用户的选择:
    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 System 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 System 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 System 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.

此问题由李海回答。

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio