关于拦WINDOWS最大化事件的问题(20分)

  • 主题发起人 主题发起人 lig
  • 开始时间 开始时间
L

lig

Unregistered / Unconfirmed
GUEST, unregistred user!
请问WINDOWS在最大化一个窗口时开始时产生什么事件,结束时产生结束事件?<br>最小化窗口呢?
 
WM_GETMINMAXINFO<br>WM_WINDOWPOSCHANGING<br>WM_WINDOWPOSCHANGED<br>WM_SYSCOMMAND
 
使用wm_syscommand消息来拦截窗口最大,最小化<br>WM_SYSCOMMAND &nbsp;<br>uCmdType = wParam; &nbsp; &nbsp; &nbsp; &nbsp;// type of system command requested <br>xPos = LOWORD(lParam); &nbsp; &nbsp;// horizontal postion, in screen coordinates <br>yPos = HIWORD(lParam); &nbsp; &nbsp;// vertical postion, in screen coordinates <br><br>&nbsp;uCmdType可以为下列值<br>SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.<br>SC_MINIMIZE (or SC_ICON) Minimizes the window.<br>
 
来晚了....
 
我又回来了!可是我也来晚了。<br>那到从大富翁论坛下来后,试着拦了一下receyes所提供的那几个事件。发现通过拦WM_SYSCOMMAND<br>可以实现这一功能。具体请看以下代码。<br>void __fastcall TForm1::MyNotify(TMessage&amp; Msg)<br>{<br>&nbsp;char *message,*message1;<br>&nbsp;bool flag=true;<br>&nbsp;switch(Msg.WParam)<br>&nbsp;{<br>&nbsp; case SC_MAXIMIZE:message="窗口正在最大化";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message1="最大化窗口完毕";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>&nbsp; case SC_MINIMIZE:message="窗口正在最小化";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message1="最小化窗口完毕";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>&nbsp; case SC_RESTORE :message="窗口开始恢复";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message1="窗口恢复完毕";<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>&nbsp; default &nbsp; &nbsp; &nbsp; &nbsp; :flag=false;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>&nbsp;}<br>&nbsp;if (flag==true)<br>&nbsp; &nbsp;{<br>&nbsp; &nbsp; MessageBox(Handle,message,"提示信息",MB_OK);<br>&nbsp; &nbsp; TForm::Dispatch(&amp;Msg);<br>&nbsp; &nbsp; MessageBox(Handle,message1,"提示信息",MB_OK);<br>&nbsp; &nbsp;}<br>&nbsp;else<br>&nbsp; &nbsp; &nbsp;TForm::Dispatch(&amp;Msg);<br>}<br>//---------------------------------------------------------------------------<br>以下在头文件中定义:<br>MESSAGE virtual void __fastcall MyNotify(TMessage&amp; Msg);<br>BEGIN_MESSAGE_MAP<br>MESSAGE_HANDLER(WM_SYSCOMMAND,TMessage,MyNotify);<br>END_MESSAGE_MAP(TForm)<br>此外,还该拦鼠标双击事件,判断是否双击任务条,和单击应用程序任务栏部分的事件。不过以上<br>这段代码对于我来说已经足够了。
 
多人接受答案了。
 
后退
顶部