Hi everyone.

I already know how to create a program using just one window.. but I'm having trouble creating a program with 2 windows.

I used CreateWindow() to create my second window, however, my second window displays exactly what is on my main window!

I figured the reason was because my WinProc function was handling messages for all windows (including the second window), and so on WM_PAINT, everything intended to be painted on the main window.. also gets displayed on the second window as well.

What I would like to know is how I would get my second window to have its window messages handled by a SEPERATE handling function (aside from WinProc).

Note: I've already managed to create a second WndProc function, the problem is.. I do not know how to set my second window.. to USE that second WndProc function. Even though there is a second WndProc function created.. my second window still utilizes the first WndProc function for all of its window messages!

Thank you for your help.

The idea with the WinProc function is that the first parameter "hwnd" is the handle of the window whose message belongs to. So what you need to do is have a simple conditional inside the WinProc to redirect the message handling depending if the hwnd is for the first or second window.

This question has already been answered. Start a new discussion instead.