Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC
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 17-Dec-12 23:09pm
Comments
Jochen Arndt at 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).
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

// Is some rule here?
 
I think, the coded char "want" to be unique in this case Smile | :)
 
(Maybe, the WM_KEYDOWN will be more effective for you)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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?[^].
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 325
1 Sergey Alexandrovich Kryukov 289
2 CPallini 275
3 DamithSL 260
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100