title: Triggering mouse events on static controls
body: <p>How can I trigger a mouse drag event on a static control?</p>
  
  <hr>
  
  <p><strong>Edit:</strong></p>
  
  <p>Is this how subclassing works? Then how can I add new messages to the window class (mouse click etc.)?</p>
  
  <pre><code>WNDPROC wpOrigKnobProc;
  
  LRESULT CALLBACK wpKnobProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
      switch (uMsg) {
          // So here I can receive custom messages for the control?
      }
      return CallWindowProc(wpOrigKnobProc, hwnd, uMsg, wParam, lParam);
  }
  
  LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
      switch (uMsg) {
          case WM_CREATE:
              {
                  HWND hctl = CreateWindowEx(0, "STATIC", NULL, SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE, 90, 10, 64, 64, hwnd, (HMENU) KNOB, GetModuleHandle(NULL), 0);
                  wpOrigKnobProc = (WNDPROC) SetWindowLong(hctl, GWL_WNDPROC, (LONG) wpKnobProc);
              }
              return 0;
      }
      return DefWindowProc(hwnd, uMsg, wParam, lParam);
  }
  </code></pre>
  
  <p>Thanks!</p>