title: Specifying a Window Procedure for child Windows
body: <p>I would like to know if its possible to specify a WndProc for a Child Window created by <code>CreateWindowEx</code>.</p>
  
  <p>I have created a Window Class, the Main Window, the Window Procedure and a Message Loop already. The code works and I decided to keep it out for the clarity of my question.</p>
  
  <p>This is my Window Proc, so far:</p>
  
  <pre><code>LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  {
      switch (uMsg)
      {
          // Creation of the Win32 Window
          case WM_CREATE:
              // Add an Edit Field
              CreateWindowEx(
                  WS_EX_CLIENTEDGE,
                  "EDIT",
                  "",
                  WS_CHILD | WS_VISIBLE,
                  5, 5, 200, 24,
                  hwnd,
                  (HMENU)100,
                  g_Instance, // Comming from WinMain
                  NULL
              );
              return DefWindowProc(hwnd, uMsg, lParam, wParam);
          case WM_KEYDOWN:
              // Track key presses on the edit field
              std::cout &lt;&lt; "The key with the code " &lt;&lt; wParam &lt;&lt; " was pressed." &lt;&lt; std::endl;
              return 0;
          case WM_PAINT:
              // Some painting code...
              return DefWindowProc(hwnd, uMsg, lParam, wParam);
          default:
              return DefWindowProc(hwnd, uMsg, lParam, wParam);
      }
  }
  </code></pre>
  
  <p>I expected key presses on the child Edit Field that I created to throw a WM_KEYDOWN message, but they dont! The keys just get added to the Edit Field in my Window but do not cause a WM_KEYDOWN message.</p>
  
  <p>It seems that the created Edit Window does not use my WndProc. How can I change that?</p>