Window Procedure within class
<p>I'm wondering why the window-procedure within a class is only working if I return the non-static window procedure. So, why do I have to return the window procedure for manipulating the current window - why is a function-call not enough?</p>

<p>I used the example from here: 
<a href="http://www.codeproject.com/Articles/17894/Simple-Mapping-of-WndProc-to-your-Specific-Class-W" rel="nofollow">http://www.codeproject.com/Articles/17894/Simple-Mapping-of-WndProc-to-your-Specific-Class-W</a></p>

<pre><code>LRESULT CALLBACK Win::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {    
// Recover the pointer to our class, don't forget to type cast it back

CWin* winptr = (CWin*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
// Check if the pointer is NULL and call the Default WndProc

if (winptr == NULL) {
    return DefWindowProc(hwnd, message, wParam, lParam);
} else {
    // Call the Message Handler for my class (MsgProc in my case)

    return winptr-&gt;MsgProc(hwnd, message, wParam, lParam); // &lt;-- 
}
</code></pre>

<p>The member function which is being called looks like this:</p>

<pre><code>switch (msg) {
case WM_NCPAINT:
    break;
    ...
}
</code></pre>

<p>Actually the current window should be only white. Without any title bar, etc.
This works only if I return the function</p>

<pre><code>return winptr-&gt;MsgProc(hwnd, message, wParam, lParam); // working 

winptr-&gt;MsgProc(hwnd, message, wParam, lParam); // has no effect
</code></pre>

<p>So, why do I have to return the function so that I can manipulate the current window? </p>