title: Pass extra wParam/lParam parameters?
body: <p>A standard window procedure function takes this prototype:</p>
  
  <pre><code>LRESULT CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  </code></pre>
  
  <p>When a message such as <code>WM_MOUSEMOVE</code> or <code>WM_CHAR</code>, the <code>WndProc</code> function will receive the window the message originated from, and any extra parameters, which will be with msg and wParam/lParam.</p>
  
  <p>What I have now is a class. Say</p>
  
  <pre><code>class Random
  {
      public:
          void Initialize ();
  
      private:
          void Draw ();
          HWND hWnd;
  
      friend LRESULT CALLBACK RandomProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  };
  </code></pre>
  
  <p>After the <code>hWnd</code> is initialized and created by <code>Initialize ()</code>, it will send messages such as <code>WM_LBUTTONDOWN</code> to <code>RandomProc</code>. Once a message is received, I would like <code>RandomProc</code> to use <code>Draw ()</code> to redraw the window of the class <code>Random</code>.</p>
  
  <p>The thing is, I will have multiple <code>Random</code> variables, and each will have a window. All the windows will send their messages to <code>RandomProc</code>, and will want it to redraw the corresponding windows of the <code>hWnd</code>. I do not know which random variable sent the message based upon the hWnd parameter nor the msg/wParam/lParam, and so cannot access the appropriate <code>Draw ()</code> function and cannot redraw the correct window. </p>
  
  <p>Is there a way to pass a pointer to the class of the window to the Procedure every time a message is sent or is there another way to access the Random class whose hWnd sent the message?</p>