resources in extension dll's

Here is my problem.  I have an extension DLL that has some dialog boxes inside of it.  I want to use those dialog boxes inside of an exe program how would I do that?  Is there a way that the exe can use the DLL's dialogs just like it was its own?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

-copy your dialog's h file into the exe's project
- add AFX_EXT_CLASS after class declaration
class AFX_EXT_CLASS CMyDialog: public CDialog...
- instantiate as usual
- before constructing CMyDialog above
use AfxSetResourceHandle(YOUR_DLL_HANDLE_HERE) ;
after calling DoModal() of dialog use AfxSetResourceHandle(BACK_TO_PREVIOUS_HANDLE);

- do not forget to link exe with Dialog DLL's Obj module.

Hope this helps


forget to say
that your Dialogs DLL should define dialogs as following

class __declspec(dllexport) CMyDialog : public ...

I use the following #defines for exported classes

#define _DIALOG_EXT_CLASS_ __declspec(dllexport)
#define _DIALOG_EXT_CLASS __declspec(dllimport)

class _DIALOG_EXT_CLASS_ CmyDialog:public CDIalog

I define __DIALOG_IMPLEMENTATION_ in stdafx.h of the dll module and use the same dialog class header for both projects (dll and exe).

simongodAuthor Commented:
i kind of understand what you are saying.  Let me show you the example that I am using and maybe you can help me to understand it.  Below is the link to that page at Code Guru.
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

simongodAuthor Commented:
CDialog's constructor need the owner window pointer - OWNERWINDOW_HERE is the CWnd * to dialog's owner or NULL if dialog does not have owner window.

I looked over the URL you posted,
it is implemented exactly the way I told you about.

The main trick is to set resource handle so your exe will be able to find dialog resource in DLL.

What kind of help you need?
Article explains everything very clear.
just create two files  EXTDLLState.h and .cpp
#include them and change a call to DoModal();
that's it

If you have questions - post them together with source files (at least dll main module, dialog class, and exe's snippet with call to DLL's dialog)

simongodAuthor Commented:
another problem when I click on the close button (little x in the top right corner of the dialog box) the dialog box doesn't close.  How can I get rid of the dialog box?  The way that I am using it if I enter info in some edit controls in the dialog can the exe use that info?  How would that be done.
I need sources to answer that question

To pass entered text into main exe you can use member variables and DDX routines.

save entered  text into member variables in Dilaog

then in exe

Dialog dlg;
CString strEnteredText = dlg.m_strText1;

in dialog you need DDX_xxxx() Data exchange routines. Clas Wizard can do most work for you.
simongodAuthor Commented:
you need to see my source to figure out why I cannot close the DLL's dialog box?
simongodAuthor Commented:
let me have your email and I will send it to you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
simongodAuthor Commented:
the file is about 1.5 meg I hope that you can handle that.
simongodAuthor Commented:
Thanks for the help everything works and i have improved upon the concepts to fir my needs
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.