在基于MFC的对话框程序中,当选中对话框属性的"Context Help"时,在对话框的关闭按钮旁边会有一个"?",我想在程序运行时点击这个"?"就弹出我的关于对话框该怎么做???
解决方案 »
- MFC中两次修改画笔出错:Uncaught exception in WindowProc
- 关于vc2005编译的问题
- 如何限制线程的数量
- 请教,制作皮肤比较专业的公司有哪些
- 求救经典编程题目池塘夜雨
- 求救!请问如何调用另一台机器上的DCOM服务组件?着急啊,帮帮忙!
- 新手上路,提个简单的问题,希望能得到高手的指点.
- 菜鸟请教:sqrt函数为什么编译通不过?
- 怎样捕获CWnd的OnEraseBkgnd消息?我直接声明了一个CWnd类型的窗口,而没有进行子类化,怎样捕获它的消息?
- UP者有分:VC程序出错!请求教
- 100分,怎么对另外一个程序的SysListView32的行进行光标定位
- 请问一下新手学习C++,VC开发用什么工具好啊?另外帮忙推荐下看些什么书呢!谢谢了!
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else if(nID == 61824)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal(); }
ON_COMMAND(ID_HELP, CWinApp::OnHelp),在WinHelp(DWORD dwData, UINT nCmd)函数中可自己处理
add the following to the message map:
ON_COMMAND(ID_HELP, OnHelp)
and add
afx_msg void OnHelp();
to AFX_MSG section:
//{{AFX_MSG(MyClass)
afx_msg void OnHelp();
//}}AFX_MSG
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
if(nID == 61824)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}2楼的应该这样,否则关闭按钮不能用了
看下msdn的资料
WM_SYSCOMMAND
A window receives this message when the user chooses a command from the window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.WM_SYSCOMMAND
uCmdType = wParam; // type of system command requested
xPos = LOWORD(lParam); // horizontal position, in screen coordinates
yPos = HIWORD(lParam); // vertical position, in screen coordinates
Parameters
uCmdType
Specifies the type of system command requested. This parameter can be one of the following values. Value Meaning
SC_CLOSE Closes the window. (((((((//关闭按钮)))))))
SC_CONTEXTHELP ((((((((((((帮助按钮)))))Changes the cursor to a question 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 Maximizes the window.
SC_MINIMIZE Minimizes the window.
SC_MONITORPOWER Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
lParam can have the following values:1 means the display is going to low power.2 means the display is being shut off.
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 Activates the Start menu.
SC_VSCROLL Scrolls vertically.
xPos
Specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, the xPos parameter is not used.
yPos
Specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is –1 if the command is chosen using a system accelerator, or zero if using a mnenomic.
Return Values
An application should return zero if it processes this message.