Solved

DLG in a DLL

Posted on 1998-09-11
6
714 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
sumNumber challenge 16 139
dog bark java program 15 111
either24  challenge 19 101
Way to decrease size of apk file 9 88
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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