[comp.windows.ms] Multiple 'main' windows ?

biegansk@umn-cs.CS.UMN.EDU (Paul Bieganski) (03/15/89)

Question for Windows vets:
None of the documentation (+ books) I've checked mentions the
possibility (?) of having more than 1 'main window' (i.e. 
an OVERLAPPED style window with NULL parent, with its own menu etc.).
I've tried it and it seems to work (sort-of) - everything is fine
except for the fact that some messages mysteriously don't make it
to the message processor of my 2'nd (and following) windows - 
PAINT sometimes (?!) makes it, COMMAND never (!) makes it (even
though the menu 'works' and SPY shows all messages coming in OK).
I hope the bug is on my side - please respond if you've had any
experience with the above case (Email ok - I'll summarize). 
Thanks in advance
Paul
******************************************************************************

bturner@hpcvlx.HP.COM (Bill Turner) (03/17/89)

> I've tried it and it seems to work (sort-of) - everything is fine
> except for the fact that some messages mysteriously don't make it
> to the message processor of my 2'nd (and following) windows - 

I know that accelerator messages wouldn't show up in the 2nd et al
windows without a lot of work, since TranslateAccelerator sends the
message to the specified window (hWnd), regardless of which window
was to get the message...

You could do something like this (making sure the toplevel windows
didn't have overlapping accelerator definitions):

    while (GetMessage(...)) {
	if (TranslateAccelerator(hWnd1, hAccels1, &msg))
	    continue;
	if (TranslateAccelerator(hWnd2, hAccels2, &msg))
	    continue;
	etc.
    }

You might also get the WM_ACTIVATEAPP message only in the first
window.  I can't think of any others, though.  I'm a bit surprised
that WM_COMMAND doesn't come in correctly (other than the accelerators
case above).

--Bill Turner