一些关于vc的问答

源代码在线查看: subject_44725.htm

软件大小: 8176 K
上传用户: RSY527
关键词: 问答
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				序号:44725 发表者:剑月明 发表日期:2003-06-23 00:01:40
				主题:怎样重载标题栏上的最小化,关闭按钮消息啊?
				内容:急!!
				返回上页访问论坛
				
				
				回复者:bird 回复日期:2003-06-23 09:04:16
				内容:最大化、最小化将发送WM_SYSCOMMAND消息。要处理该消息,可以这么做:     1、在Form的头文件中添加:      void __fastcall RestrictMinimizeMaximize(TMessage &Msg);           BEGIN_MESSAGE_MAP      MESSAGE_HANDLER(WM_SYSCOMMAND, TMessage, RestrictMinimizeMaximize)      END_MESSAGE_MAP(TForm)     2、在Form的单元文件中添加:         void __fastcall TForm1::RestrictMinimizeMaximize(TMessage& Msg)      {      if (Msg.WParam == SC_MINIMIZE)      {      //catches minimize...      }      else if (Msg.WParam == SC_MAXIMIZE)      {      //catches maximize...      }      TForm::Dispatch(&Msg);      // or "else TForm::Dispatch(&Msg)" to trap      }     关闭窗口的消息为WM_CLOSE,C++Builder提供了OnClose事件
				
				返回上页访问论坛
				
				
				答案被接受回复者:bird 回复日期:2003-06-23 09:04:29
				内容:你应该截取 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. 
				
				返回上页访问论坛
				
				
				回复者:VChen 回复日期:2003-06-25 00:17:50
				内容:下载例子
				
				返回上页访问论坛
							

相关资源