title: Win32 textbox control alt keypress message
body: <p>I need to hookup alt+alphanumberic keypress inside a child window control.</p>
  
  <p>I have written this program to test it's functionality. But it seems it does not response to keystrokes 
  like ALT+X , ALT+X which are necessary for my application(keyboard translator).</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;wchar.h&gt;
  #include &lt;tchar.h&gt;
  #include &lt;string.h&gt;
  
  #ifndef NULL
  #define NULL 0
  #endif
  
  /* glaobal variables */
  HWND hwndEdit = NULL;
  HWND hwndWindow = NULL;
  WCHAR* lpszClassName  = L"Vijesekara Keyboard Test Application";
  WCHAR* lpszAppName = L"Vijesekara Keyboard Test Application";
  int main_window_width = 0;
  int main_window_height = 0;
  WNDPROC edit_old_wndproc;
  
  /*
    GWL_WNDPROC
  */
  #ifndef GWL_WNDPROC 
  #define GWL_WNDPROC (-4)
  #endif
  
  /* child window ID's */
  #ifndef __CHILD_WINDOW_EDIT_ID__
  #define __CHILD_WINDOW_EDIT_ID__
  #define ID_EDIT     2000
  // :TODO: more comes from here //
  #endif 
  
  
  /* constrains on child window positions */
  #ifndef __CHILD_WINDOW_POSITION__
  #define __CHILD_WINDOW_POSITION__
  #define EDIT_CHILD_LEFT_PRECENTAGE 0.05
  #define EDIT_CHILD_RIGHT_PRECENTAGE 0.05
  #define EDIT_CHILD_TOP_PRECENTAGE 0.10
  #define EDIT_CHILD_BOTTOM_PRECENTAGE 0.10
  // :TODO: Other controls //
  #endif
  
  /* main window procedure */
  LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam);
  /* edit box procedure */
  LRESULT CALLBACK EditBoxProc(HWND ,UINT , WPARAM , LPARAM );
  
  /* resize child windows */
  void ResizeChildWindows();
  
  /* win main entry */
  int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                      PSTR szCmdLine, int iCmdShow)
  {
  
    WNDCLASS wndclass;
  
    wndclass.style = CS_HREDRAW |CS_VREDRAW ;
    wndclass.lpfnWndProc = WndProc;
    wndclass.cbClsExtra = 0;
    wndclass.hInstance = hInstance ;
    wndclass.hIcon = (HICON)LoadIcon(NULL,IDI_APPLICATION);
    wndclass.hCursor = (HCURSOR)LoadCursor(NULL,IDC_ARROW);
    wndclass.hbrBackground =(HBRUSH) GetStockObject( WHITE_BRUSH );
    wndclass.lpszMenuName = NULL ;
    wndclass.lpszClassName = lpszClassName ;
  
    /* Register class */
    int result ;
    result = RegisterClass( &amp;wndclass) ;
  
    /* if failed to register window */
    if ( 0 == result )
    {
      MessageBox(NULL,L"Registering Window Have Been Failed" , lpszAppName, MB_OK);
      exit(0);  
    }
  
    /* Create the window */
    hwndWindow = CreateWindow(lpszAppName , lpszAppName ,WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,\
                   CW_USEDEFAULT, CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
    if(NULL == hwndWindow )
    {
      MessageBox(NULL,L"Window Creation have being failed", lpszAppName,MB_OK);
      exit(0); 
    }              
    ShowWindow(hwndWindow, iCmdShow);
  
    /* Enter message loop */
    MSG msg ;
    while(GetMessage(&amp;msg,NULL, 0,0 ))
    {
      TranslateMessage(&amp;msg);
      DispatchMessage(&amp;msg); 
    } 
    return msg.wParam;
  }
  
  /* window procedure */
  LRESULT CALLBACK WndProc (HWND hwnd, UINT message,WPARAM wParam,LPARAM lParam)
  {
    switch(message)
    {
      case WM_CREATE:
       if( hwndEdit != NULL)
       {
          MessageBox(NULL,L"Edit control handle have already initialized",lpszAppName , MB_OK);
          exit(0);
       } 
       hwndEdit = CreateWindow( L"edit" ,NULL, WS_CHILD|WS_VISIBLE|WS_VSCROLL\
                                |WS_BORDER|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL,0,0,0,0,hwnd,(HMENU)ID_EDIT\
                                ,GetModuleHandle(NULL),NULL);
       if( NULL == hwndEdit )
       {
         MessageBox(hwnd, L"Edit child window control creation failed", lpszAppName, MB_OK);
         exit(0);
       }   
  
      edit_old_wndproc = (WNDPROC)SetWindowLongPtr(hwndEdit,GWL_WNDPROC,(LONG_PTR)EditBoxProc );
        break;
  
      case WM_SIZE:
         main_window_height = HIWORD(lParam);
         main_window_width = LOWORD (lParam);
         ResizeChildWindows();
         return 0;
      case WM_COMMAND:
  
        /*:TODO:process */
        break; 
  
      case WM_DESTROY:
  
         PostQuitMessage(0);
         return 0; 
      default:
        return DefWindowProc(hwnd,message,wParam,lParam);
    }
    return DefWindowProc(hwnd,message,wParam,lParam);
  }
  
  /* resize window procedure */
  void ResizeChildWindows()
  {
    MoveWindow(hwndEdit,main_window_width*EDIT_CHILD_LEFT_PRECENTAGE , main_window_height* EDIT_CHILD_TOP_PRECENTAGE , \
      main_window_width * (1- EDIT_CHILD_LEFT_PRECENTAGE - EDIT_CHILD_RIGHT_PRECENTAGE)          ,// height 
      main_window_height * (1- EDIT_CHILD_TOP_PRECENTAGE - EDIT_CHILD_BOTTOM_PRECENTAGE), TRUE   // width 
   );  
  }
  static int alt=0;
  static int ctl=0;
  static int sys =0;
  WCHAR buffer[1024];
  
  LRESULT CALLBACK EditBoxProc(HWND hwnd, UINT message, WPARAM wParam , LPARAM lParam)
  {
    switch ( message)
    {
  
      case WM_SYSCHAR:
        sys =1;
        if( lParam &amp;&amp; (1&lt;&lt;29) ) { alt= 1;}
        else { 
          alt=0;
        }
  
      case WM_KEYPRESS:
        wsprintf( buffer,TEXT("KeyCode is :%d"), wParam);
        MessageBox( NULL,buffer, TEXT("Vijesekara Keyboard"), MB_OK);
        SetFocus(hwnd);
        /* keyboard procedure */
  
  
      alt =0;
      if ( sys==1)
      {
        sys=0;
        break;
        }
  
      return 0;
  
      default:
        break;
    }
    return CallWindowProc(edit_old_wndproc ,hwndEdit,message,wParam,
             lParam);
  }
  
  
  // end of vijesekara_keyboard.cpp
  </code></pre>
  
  <p>Note: Inside the subclassed  textbox , the WM_CHAR message is not working for the alt keystrokes, I it does
  not sent a WM_CHAR message with alt key pressed to the for AlT+keystokes.So I log all the messages using spy++
  and then I found WM_SYSCHAR have been sent instead of WM_CHAR for those messages inside a editbox child
  window.</p>
  
  <p>Any idea how could I do this?</p>
  
  <p>--Thanks in advance--</p>