[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DLG in a DLL

Posted on 1998-09-11
6
Medium Priority
?
728 Views
Last Modified: 2013-11-20
Hello!

I have a dll which contains two dialogs.
Now I want to test this dll and more specifically the dialogs, but all I get is an assert exception (afxCurrentResourceHandle is equal to NULL)
The dialogs are called from within the dll and not from the testprogram.
I guess this is a two-part question :
1. Is it important what the testprogram is, I mean can it be a console application, since all the dlgs and resources are in the dll or does it have to be a mfc app?
2. what do I need to do to get the dll find its own resource?

so again:
I do not call the dialog from the testprogram, it is used only internally in the dll.
0
Comment
Question by:M031097
[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
  • 4
6 Comments
 
LVL 12

Accepted Solution

by:
migel earned 200 total points
ID: 1322065
Try to use
AfxSetResourceHandle(HINSTANCE hInstResource)
where hInstResource - hInstance of your DLL.
by default MFC uses hInstance of the current APP. Thus if your testapp is not MFC application then current afxCurrentResourceHandle is never initialised.
0
 

Author Comment

by:M031097
ID: 1322066
I did setresource and that worked, although now I got afxCurrentInstanceHandle !=NULL assertion.....???
0
 

Author Comment

by:M031097
ID: 1322067
heh
the dialog was shown though :-)
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:M031097
ID: 1322068
Do you know why I get the instance assertion?
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1322069
Why not try...

AFX_MANAGE_STATE( AfxGetStaticModuleState( ))

(no semicolon)

as the first line inside every exported function in the DLL.

Phillip
0
 

Author Comment

by:M031097
ID: 1322070
AFX_MANAGE_STATE did not work...
I find it quite strange really, the AfxSetResource works with the DLL's instance, so why is the afxCurrentInstance equalt to NULL?
I am inside the DLL and current instance should be that..right?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

649 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