Solved

Dialog box in an extension dll

Posted on 1998-10-01
12
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +1
12 Comments
 

Author Comment

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

Accepted Solution

by:
mikeblas earned 100 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sum67 challenge 35 116
ShiftLeft challenge 21 90
fix34  challenge 9 167
Change to event 1 129
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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