Click here to Skip to main content
15,885,078 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
C++
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);
    //....


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!
Posted
Comments
Jochen Arndt 18-Dec-12 5:29am    
Voted this question with a 5 which I'm doing very seldom. The returned WM_CHAR key value for Ctrl+BS is indeed 0x7F. A Google research found only one useful hit (see my answer).

// 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)
 
Share this answer
 
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?[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900