Solved

DLG in a DLL

Posted on 1998-09-11
6
721 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
Technology Partners: 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

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
Excel Use VBA to get user's Mac Address for their computer 5 402
string initialization in java 11 121
Problem to App 4 143
Problem to Office 1 65
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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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