[comp.windows.ms] Windows management from dynamic link libraries

phco@ecsvax.uncecs.edu (John Miller) (01/28/89)

I'm having difficulty figuring out how to create and manage windows
from a dynamic link library that is loaded from a main program after
program initialization (the main program does not know the name or
contents of the DLL until the DLL is selected from a list of DLLs
on disk).  As I understand it from Petzold's book, DLLs do not receive
messages from Windows and so must peek at the main program's message
queue.  The only exception is for modal dialog boxes, which get their
messages directly.  However, I really need full popup windows, or at
least a modeless dialog box.

Can anyone offer some suggestions (or maybe even a little code) about
windows management from within a DLL?


-- 
                        John Miller  (ecsvax!phco)
                        Dept. of Pharmacology, Univ. of N.C.-Chapel Hill
			CB#7365   1026 FLOB
                        Chapel Hill, NC 27599       (919) 966-6966

bturner@hpcvlx.HP.COM (Bill Turner) (01/31/89)

> I'm having difficulty figuring out how to create and manage windows
> from a dynamic link library that is loaded from a main program after
> program initialization (the main program does not know the name or
> contents of the DLL until the DLL is selected from a list of DLLs
> on disk).  As I understand it from Petzold's book, DLLs do not receive
> messages from Windows and so must peek at the main program's message
> queue.  The only exception is for modal dialog boxes, which get their
> messages directly.  However, I really need full popup windows, or at
> least a modeless dialog box.
>
> Can anyone offer some suggestions (or maybe even a little code) about
> windows management from within a DLL?

Well, if you're using GetMessage/TranslateMessage/DispatchMessage as
your main loop, the messages will get to windows created in the DLL
just fine.  Remember, all dialog controls are windows registered by
a DLL, and you can create and use them just as any other window.

What exactly is the problem you're having?  If you register the window
class and have the code in the DLL, it should work fine.

--Bill Turner