回车键问题

小兰 2014-04-25 09:21:17
win32
本来是点击界面某个区域就跳到下个界面,现在要求是按enter键进入下个界面
switch (Message)
{
case WM_KEYDOWN:
{
switch(wParam)
{
case VK_RETURN:
xxxxxxxxxxx
break;
}
}
}
请问这样子定义为什么没有反应了,急!
...全文
445 42 打赏 收藏 转发到动态 举报
写回复
用AI写文章
42 条回复
切换为时间正序
请发表友善的回复…
发表回复
__cc__ 2014-05-09
  • 打赏
  • 举报
回复
引用 41 楼 fuyuecao 的回复:
[quote=引用 40 楼 neustar1 的回复:] 不厚道,解决了问题居然不结贴。。。。。。。。。,下回见这样的就不理睬
不好意思,现在就结贴,其实问题还没解决[/quote] 还没解决?什么意思
小兰 2014-05-08
  • 打赏
  • 举报
回复
引用 40 楼 neustar1 的回复:
不厚道,解决了问题居然不结贴。。。。。。。。。,下回见这样的就不理睬
不好意思,现在就结贴,其实问题还没解决
__cc__ 2014-04-28
  • 打赏
  • 举报
回复
不厚道,解决了问题居然不结贴。。。。。。。。。,下回见这样的就不理睬
C++实习生 2014-04-27
  • 打赏
  • 举报
回复
如果是CreateDialog写的话,应该个有 getmessage消息循环。 while(getmessage(msg,0,0,0,0,0)) { 这里加一行 if(msg.message ==WM_KEYDOWN and (HIWORD)还是LOWORD(LPARAM) ==VK_RETURN) then 发送到自己 的窗口中 SEND(M—HWND,msg.messsage,wp,lp) end if buildermsg ... dispathmsg .... }
为争 2014-04-25
  • 打赏
  • 举报
回复
楼主,拿到代码能贴出来看看吗?
小兰 2014-04-25
  • 打赏
  • 举报
回复
引用 14 楼 zhao4zhong1 的回复:
WM_KEYUP
哥,到底是哪个
赵4老师 2014-04-25
  • 打赏
  • 举报
回复
WM_KEYUP
赵4老师 2014-04-25
  • 打赏
  • 举报
回复
WM_KEYDUP
fifibo 2014-04-25
  • 打赏
  • 举报
回复
对话框程序?
小兰 2014-04-25
  • 打赏
  • 举报
回复
引用 11 楼 s_hhm 的回复:
楼上++ 所有的消息都是在这里处理的.你在你程序中的回调函数中去处理WM_KEYDOWN 或WM_KEYUP WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); 键码好像是13 十进制的记不清了,你设置个段点就可以看出来是几了?
BOOL CALLBACK WindowProc (HWND hwnd, UINT message,WPARAM wParam, LPARAM lParam)// 3 { switch (message) { case WM_KEYDOWN: { switch(wParam) { case VK_RETURN: XXXXXXX break; } } break; } return FALSE ; } 没有反应,捉急
s_hhm 2014-04-25
  • 打赏
  • 举报
回复
楼上++ 所有的消息都是在这里处理的.你在你程序中的回调函数中去处理WM_KEYDOWN 或WM_KEYUP WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); 键码好像是13 十进制的记不清了,你设置个段点就可以看出来是几了?
小兰 2014-04-25
  • 打赏
  • 举报
回复
引用 8 楼 focuslight 的回复:
未取得窗口焦点?
WM_SETFOCUS?没有控件也行嘛?具体的不会操作,请大哥指教
__cc__ 2014-04-25
  • 打赏
  • 举报
回复
// Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { ////////////在这里处理WM_KEYDOWN if (bHandle) { TranslateMessage(&msg); DispatchMessage(&msg); } } }
Arnis1973 2014-04-25
  • 打赏
  • 举报
回复
未取得窗口焦点?
小兰 2014-04-25
  • 打赏
  • 举报
回复
引用 6 楼 neustar1 的回复:
[quote=引用 5 楼 fuyuecao 的回复:] [quote=引用 4 楼 neustar1 的回复:] 可以参考一下 http://www.360doc.com/content/11/0817/16/6828497_141192223.shtml
win32,不是MFC,怎么办[/quote] CDialog有个PreTranslateMessage方法,重写并在里面处理WM_KEYDOWN[/quote] 这个是MFC消息吧
__cc__ 2014-04-25
  • 打赏
  • 举报
回复
引用 5 楼 fuyuecao 的回复:
[quote=引用 4 楼 neustar1 的回复:] 可以参考一下 http://www.360doc.com/content/11/0817/16/6828497_141192223.shtml
win32,不是MFC,怎么办[/quote] CDialog有个PreTranslateMessage方法,重写并在里面处理WM_KEYDOWN
小兰 2014-04-25
  • 打赏
  • 举报
回复
引用 4 楼 neustar1 的回复:
可以参考一下 http://www.360doc.com/content/11/0817/16/6828497_141192223.shtml
win32,不是MFC,怎么办
__cc__ 2014-04-25
  • 打赏
  • 举报
回复
可以参考一下 http://www.360doc.com/content/11/0817/16/6828497_141192223.shtml
__cc__ 2014-04-25
  • 打赏
  • 举报
回复
引用 2 楼 fuyuecao 的回复:
[quote=引用 1 楼 neustar1 的回复:] 对话框程序?
是的,CreateDialog,但是没有添加控件,靠指定区域实现。比如 case WM_LBUTTONDOWN: if (LOWORD(lParam) >= 88 && LOWORD(lParam) <= 97 && HIWORD(lParam) >= 64 && HIWORD(lParam) <= 56) { }[/quote] 对话框的OnOK会响应回车键,把OnOK里面的代码注释掉试试。
小兰 2014-04-25
  • 打赏
  • 举报
回复
引用 1 楼 neustar1 的回复:
对话框程序?
是的,CreateDialog,但是没有添加控件,靠指定区域实现。比如 case WM_LBUTTONDOWN: if (LOWORD(lParam) >= 88 && LOWORD(lParam) <= 97 && HIWORD(lParam) >= 64 && HIWORD(lParam) <= 56) { }
加载更多回复(22)

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧