Solved

DLG in a DLL

Posted on 1998-09-11
6
678 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
  • 4
6 Comments
 
LVL 12

Accepted Solution

by:
migel earned 100 total points
Comment Utility
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
Comment Utility
I did setresource and that worked, although now I got afxCurrentInstanceHandle !=NULL assertion.....???
0
 

Author Comment

by:M031097
Comment Utility
heh
the dialog was shown though :-)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

Expert Comment

by:psdavis
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now