本文介绍了关于MSG的一点关于WM_CHAR的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 static LRESULT CALLBACK ComboBox_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){case WM_CHAR: if(VK_BACK ==wParam)//让回退正常处理 return CallWindowProc((WNDPROC)GetProp(hwnd, TEXT("Wprc")), hwnd, msg, wParam, lParam); //.... 当我纯粹按下VK_BACK时,if子句会起作用; wParam是0x00000008。 但是当我按下Ctrl键按下VK_BACK时,wParam是0x0000007f。 我只是不明白,为什么wParam会这样?这里有一些规则吗? 同时,如果我有时需要处理不同的Key_Down,可能会按某些Ctrl_Key,Ctrl或Alt或Shift,我该如何处理它? 注意: 在上面的sample.GetKeyState()不是适用! 因为wParam的值已经改变了!when I purely pressed VK_BACK the if clause will work; wParam is 0x00000008.But When I pressed VK_BACK with Ctrl-pressed,wParam is 0x0000007f.I just don''t understand it, why the wParam get so? Is some rule here?In the mean time,If I sometimes need to deal with different Key_Down ,and may with some some Ctrl_Key pressed,Ctrl or Alt or Shift,How Can I deal with it ?NOTE:In above sample.GetKeyState() is not applicable!Becuse the wParam''s value changed!推荐答案 //这里有一些规则吗? br /> 我认为,在这种情况下编码字符想要是唯一的:) (也许, WM_KEYDOWN 对你更有效)// Is some rule here?I think, the coded char "want" to be unique in this case :)(Maybe, the WM_KEYDOWN will be more effective for you) 代码0x7F是ASCII DEL字符。也许MS的某个人决定在 Ctrl + BackSpace 上返回此代码,因为它不会被任何其他密钥返回。 参见此博客发布: WM_KEYDOWN / WM_CHAR输入中有什么问题model? [ ^ ]。The code 0x7F is the ASCII DEL character. Maybe someone at MS decided to return this code upon Ctrl+BackSpace because it is not returned by any other key.See also this Blog post: What''s broken in the WM_KEYDOWN/WM_CHAR input model?[^]. 这篇关于关于MSG的一点关于WM_CHAR的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-22 00:09