?
解决方案 »
- 求内存诊断的原理、思路、最好就有开源项目
- GDI+画png图占内存
- 将const wchar_t*转换为VC能显示和输出的格式?
- 为什么VC写的控件,在VB中得不到控件的句柄呢
- BSTR 与 LPSTR相互转换??
- 那个IE->工具->Internet选项->高级那个对话框怎么做
- 急急急!高分求救!好心人请进!
- TracePlus Win32
- 如何获得网络邻居的共享文件夹的读写权限
- 问题描述:请教,我将listview中的所有item都删除之后,重新插入item,但每次要把窗口拖动一下,才能重画,现在问题的是如何能够让listvi
- 怎样使金山词霸在Pdf文件中也具有即指即译的功能?
- 堆,栈,静态存储区的区别是什么?什么时候用?
所谓”对话框中的按ENTER键的消息“实际上接收该消息的都是对话框的子控件。
所以你需要重载子控件,并进行按键消息的处理。
ENTER键为VK_RETURN
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
return 1;
return CDialog::PreTranslateMessage(pMsg);
}
if (pMsg->wParam == 0x0D ) { // ENTER键
DoEnter();
return 0;
}
if (pMsg->wParam == 0x1B) { // Cancel键
DoCancel();
return 0;
}
BOOL <ClassName>::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
{
// handle KEY_ENTER
DWORD def_id=GetDefID();
if (def_id!=0)
{
CWnd *wnd=FromHandle(pMsg->hwnd);
// you may implement other ways of testing, e.g.
// comparing to array of CWnd*, comparing to array of IDs etc. //或许你只想处理基于某一控件的回车键
char class_name[16];
if (GetClassName(wnd->GetSafeHwnd(),class_name,sizeof(class_name))!=0)
{
if (strnicmp(class_name,"edit",5)==0)
{
//忽略或转译成TAB键
pMsg->wParam = VK_TAB;
}
}
}
} return CDialog::PreTranslateMessage(pMsg);
}
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN)
{
// do your code here
...
return TRUE;
}
else if(pMsg->wParam == VK_ESCAPE)
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}