Multiple Top Level Windows
Hi All,
Firstly I'm fairly new to Win32 GUI coding so please bear with me here...
OK, I've created an application that consists of two windows, the main window implemented in winmain (RegisterClass(&wc) and CreateWindow with appropriate message loop and WndProc). I have a number of dialogs used throughout the application; these are fine. However, I have a requirement for a second form which has initially been implemented as a dialog.
However, on doing so a number of issues have cropped up. I'm using a custom control to implement a gridview (excel, sort of), however, this control causes the CPU to hit 100% if the control is created, I assume because its message loop isn't suited to being in a dialog. Used on my main window, the control has no issues. Also, I will need to be doing some GDI work on the second form, probably as a custom control so I can see there being some further issues with using a dialog.
With all of that in mind, what is the best way to implement my second form? I imagined it as a second top level window - I've tried two techniques - one with two message loops and one with one (in both cases I registered classes for both windows before creating with CreateWindow). In the first case, one of the message loops doesn't exit properly (which I suppose is to be expected, one message loop serves both of my top level windows in the second case). In the second case, if I call DestroyWindow for my second top-level window, the whole application is closed, which is not the idea.
Basically, if there is a way without using dialogs, is it possible to have two top-level windows, with one being the main window whose destruction closes the application and the other being created and destroyed as needed? Am I close?
I don't seem to be able to find any advice on the web; I've found a number of very useful Win32 tutorials that deal with creating applications of a single window and creating dialogs, as well as using most controls, but creating an application with two windows seems to be more difficult.
Any pointers to online resources would be useful, I appreciate this could be quite complex and not easily explained in a forum. I understand there are some good books out there too; I wish I had the time to read them...
Thanks in advance for any help you can offer,
Quark_77