?
Solved

Dialog box in an extension dll

Posted on 1998-10-01
12
Medium Priority
?
335 Views
Last Modified: 2013-11-20
I am trying to create a dll that contains a class derived from CDialog.  Whenever I try to call DoModal() on the class I get an assertion.  It is failing in the DoDataExchange() call in CDialog::DoModal().  "No data exchange control with ID xxxx", in my case 1005, is the problem  I have tried including the resource.h file from the dll with no luck, renamed so it would not conflict with the resource.h from the calling project.  I am developing under NT with VC++ 5 sp3.  The dll contains MFC stuff and STL stuff.

Thanks
0
Comment
Question by:tvandegr
  • 6
  • 3
  • 2
  • +1
12 Comments
 

Author Comment

by:tvandegr
ID: 1322829
Edited text of question
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 200 total points
ID: 1322830
Is the error an assertion, or a debug trace message?  The text you quote sounds like it's a debug trace message. An assertion has a very different format.

The trace message means that you've called an MFC data exchange function (like DDX_Text(), for example, or any one of its friends) in the DoDataExchange() method of a CDialog-derived class. But the ID of the control you provided in the DDX_Text() call could not be found at runtime, and therefore the DDX call failed.

Is the assertion your hitting immediately following that TRACE statement in the MFC source code, or is it some other assertion?

B ekiM

0
 

Author Comment

by:tvandegr
ID: 1322831
What I quoted is the trace statement.  The assertion is an ASSERT(FALSE) right after it.  It comes after the DoDataExchange tries to get a handle to a control and the handle is returned NULL.  Yes, you are correct with what is going on.  What I need to know is how do I have all of the IDs used in creating the dll known to the dll at run time.

Thanks

tvandegr
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:tvandegr
ID: 1322832
What I quoted is the trace statement.  The assertion is an ASSERT(FALSE) right after it.  It comes after the DoDataExchange tries to get a handle to a control and the handle is returned NULL.  Yes, you are correct with what is going on.  What I need to know is how do I have all of the IDs used in creating the dll known to the dll at run time.

Thanks

tvandegr
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1322833
"how do I have all of the IDs used in creating the DLL known to the DLL at runtime."

What are you asking? I can't parse that sentence.

Do you want to enumerate the child windows of a dialog?

B ekiM
0
 

Author Comment

by:tvandegr
ID: 1322834
Sorry.  That was a poor question and comment.  What I am trying to say is that when I do the DoModal() for the dialog box that is defined in my dll it gets the control ID (i.e. 1005) from the dll, then it tries to get a handle for that control by looking for it within the app that is including the dll, but no control is defined using that numer, so I get the assertion.  I need it to try to get the handle from the dll instead, or where ever the information for the controls in the dll are stored.  I hope this is a better explanation.

thanks,
tvandegr
0
 
LVL 1

Expert Comment

by:polimetla
ID: 1322835
Dear Brother/sister

I succussfully completed your task.
the answer is ready in my site.
please go and see.
http://members.tripod.com/~polimetla

Any doubts please let me know

with love,
Bhavani P Polimetla
Bhavani_73@hotmail.com

0
 

Expert Comment

by:umarama
ID: 1322836
Add the following code to the beginning of your DLL function:
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1322837
Sorry, you lost me again.  You say:  ".  What I am trying to say is that when I do the DoModal() for the dialog box that is defined in my dll it gets the control ID (i.e. 1005) from the dll," but dialog boxes don't have control IDs; only child windows have control IDs.

B ekiM
0
 

Author Comment

by:tvandegr
ID: 1322838
The control IDs are for controls on the Dialog box, in this case ListBoxs and Buttons.

I have tried adding the following code before any calls that use the resource IDs for the controls, for instance the DoDataExchange() method in my class to tell the dll to look internally and not in the application.  It did not seem to help.

HINSTANCE hInstResourceClient = AfxGetResourceHandle();
AfxSetResourceHandle(MY_DLL_NAMEDLL.hModule);
..
AfxSetResourceHandle(hInstResourceClient);

I was looking back and I do not think that I stated that this was an extension Dll, I do not know if this helps any.

Tom
0
 

Expert Comment

by:umarama
ID: 1322839
Read help for AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

0
 

Author Comment

by:tvandegr
ID: 1322840
I believe that AFX_MANAGE_STATE(AfxGetStaticModuleState( )) is for regular DLLs and I am writing an extension DLL.  I use it before using MFC stuff in the Regular DLLs that I have written.  When I add it into this DLL and try to compile it complaines about DLLMain already being defined in a different file.  I do not have a single function that I am exporting that opens up a dialog box.  I am exporting a class that is derived from CDialog.

tvandegr
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question