⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_44725.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:44725 发表者:剑月明 发表日期:2003-06-23 00:01:40
<br>主题:怎样重载标题栏上的最小化,关闭按钮消息啊?
<br>内容:急!!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2003-06-23 09:04:16
<br>内容:最大化、最小化将发送WM_SYSCOMMAND消息。要处理该消息,可以这么做: <BR>&nbsp;&nbsp;&nbsp;&nbsp;1、在Form的头文件中添加: <BR>&nbsp;&nbsp;&nbsp;&nbsp; void __fastcall RestrictMinimizeMaximize(TMessage &amp;Msg); <BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; BEGIN_MESSAGE_MAP <BR>&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE_HANDLER(WM_SYSCOMMAND, TMessage, RestrictMinimizeMaximize) <BR>&nbsp;&nbsp;&nbsp;&nbsp; END_MESSAGE_MAP(TForm) <BR>&nbsp;&nbsp;&nbsp;&nbsp;2、在Form的单元文件中添加: <BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; void __fastcall TForm1::RestrictMinimizeMaximize(TMessage&amp; Msg) <BR>&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp; if (Msg.WParam == SC_MINIMIZE) <BR>&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp; //catches minimize... <BR>&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp; else if (Msg.WParam == SC_MAXIMIZE) <BR>&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp; //catches maximize... <BR>&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp; TForm::Dispatch(&amp;Msg); <BR>&nbsp;&nbsp;&nbsp;&nbsp; // or "else TForm::Dispatch(&amp;Msg)" to trap <BR>&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;关闭窗口的消息为WM_CLOSE,C++Builder提供了OnClose事件
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:bird 回复日期:2003-06-23 09:04:29
<br>内容:你应该截取 WM_SYSCOMMAND消息。该消息参数为: <BR>&nbsp;&nbsp;&nbsp;&nbsp;uCmdType = wParam; // type of system command requested <BR>&nbsp;&nbsp;&nbsp;&nbsp;xPos = LOWORD(lParam); // horizontal postion, in screen coordinates <BR>&nbsp;&nbsp;&nbsp;&nbsp;yPos = HIWORD(lParam); // vertical postion, in screen coordinates <BR>&nbsp;&nbsp;&nbsp;&nbsp;其中uCmdType表示用户的选择: <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_CLOSE Closes the window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;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. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_DEFAULT Selects the default item; the user double-clicked the System menu. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_HSCROLL Scrolls horizontally. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_KEYMENU Retrieves the System menu as a result of a keystroke. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_MAXIMIZE (or SC_ZOOM) Maximizes the window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_MINIMIZE (or SC_ICON) Minimizes the window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;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. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_MOUSEMENU Retrieves the System menu as a result of a mouse click. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_MOVE Moves the window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_NEXTWINDOW Moves to the next window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_PREVWINDOW Moves to the previous window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_RESTORE Restores the window to its normal position and size. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_SIZE Sizes the window. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_TASKLIST Executes or activates Windows Task Manager. <BR>&nbsp;&nbsp;&nbsp;&nbsp;SC_VSCROLL Scrolls vertically. <BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:VChen 回复日期:2003-06-25 00:17:50
<br>内容:下载例子
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -