Solved

DLG in a DLL

Posted on 1998-09-11
6
724 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 100 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
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: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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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