Link to home
Start Free TrialLog in
Avatar of marlow
marlow

asked on

Calling DialogBox() from within a DLL

I am trying to call DialogBox() from within a DLL, every time I do, it gives me a GPF in KRNL386.  If I do the EXACT same DialogBox() call in an EXE, it works fine.  I am using Borland C++ 4.52 and the documentation hints that I should NOT use the MakeProcInstance() call if it is being used in a DLL.  I have tried removing the MakeProcInstance() calls but it still GPF's.  Another kicker is this MUST be written using 16-bit API calls  :(

Any idea's on how to correctly call the DialogBox() function from within a DLL? (the DLL has no window of it's own).
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marlow
marlow

ASKER

Need more info...

The DialogBox() function is called from within one of my procedures in my DLL, not from LibMain.  What did you say the code to do dialog boxes in DLL's are identical to?  I did not understand...

Yes, host app has message loop...
Yes the code is identical for the actual dialog box itself, to code for a dialog in an EXE.  This is actual a good way to debug/develop a dialog - as you simply write the code in an EXE and then cut/paste it to your DLL.

The DLL will rely on the main app's message loop

Also with DLL version make sure you use the correct hInst where the resource lies (presumably that of the DLL itself).