<!-- @page { margin: 2cm } TD P { margin-bottom: 0cm } P { margin-bottom: 0.21cm } -->
1. 界面上的某个控件获得了焦点的话,如果这时候按下了 Enter键,界面就会消失。
解决方案 : 重载 PreTranlateMessage虚函数,屏蔽掉 Enter键等。
if ( pMsg -> message == WM_KEYDOWN )
{
if ( pMsg -> wParam == VK_RETURN )
{
return TRUE ;
}
}
if (( pMsg -> wParam == VK_ESCAPE ) && ( pMsg -> message == WM_KEYDOWN ))
{
return TRUE ;
}
2. <!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->在 dlg 中响应 ON_UPDATA_COMMAND_UI( ON_UPDATA_COMMAND_UI_RANGE )的时候必须先调用函数,这里注意的是在VC2005中,想到中并没有这个消息,用的时候需要手动添加。
<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->
Call this member function to update the state of dialog buttons and other controls in a dialog box or window that uses the ON_UPDATE_COMMAND_UI callback mechanism.
void UpdateDialogControls(
CCmdTarget* pTarget ,
BOOL bDisableIfNoHndler
);
Parameters
-
pTarget
-
Points to the main frame window of the application, and is used for routing update messages.
-
bDisableIfNoHndler
-
Flag that indicates whether a control that has no update handler should be automatically displayed as disabled.
Remarks
If a child control does not have a handler and bDisableIfNoHndler is TRUE , then the child control will be disabled.
The framework calls this member function for controls in dialog bars or toolbars as part of the application's idle processing.