Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dialog in MFC DLL - AfxFindResourceHandle failing! - plse help!

313 views
Skip to first unread message

Clifford Smith

unread,
Jun 7, 1996, 3:00:00 AM6/7/96
to

Hi,

I have written an MFC DLL (not an extension DLL) that uses the shared
DLL version of MFC 4.0 (under Visual C++ 4.0). This DLL is being
called from a non-MFC C program through an entry-point in the MFC DLL.

In this DLL I have a dialog that I want to display. Unfortunately the
call to DoModal fails. I have traced the failure to the call to
AfxFindResourceHandle() in DLGCORE.CPP at line 445. It seems that the
program has the correct resource ID, but can't seem to find the module
in which that resource is located. It runs through the linked list of
modules, including itself, but takes the default route and returns the
current module (the executable calling the DLL). Obviously the next
call to ::FindResource fails as the dialog resource is not in that
module.

Does anyone know what the problem is? I would appreciate any help with
this problem, as I am still relatively new to MFC (actually to Windows
programming as a whole).

Regards,
Cliff


--------------------------------------------------
Clifford Smith, Johannesburg South Africa
eMail: cli...@absa.co.za
csm...@global.co.za
WWW : http://www.global.co.za/~csmith/default.htm
--------------------------------------------------

Dean D. McCrory

unread,
Jun 8, 1996, 3:00:00 AM6/8/96
to

> cli...@absa.co.za (Clifford Smith) wrote in article
<31b7fb0d....@hermes.is.co.za>...

> In this DLL I have a dialog that I want to display. Unfortunately the
> call to DoModal fails.

You need to include the following code at the top of all your entry points
(your DLL's exported functions):

AFX_MANAGE_STATE(AfxGetStaticModuleState());

Later,

--
// Dean McCrory (dean...@msn.com)
BSTR bstrDisclaimer = ::SysAllocString(OLECHAR("I speak for myself, not
Microsoft"));


Clifford Smith

unread,
Jun 10, 1996, 3:00:00 AM6/10/96
to

Hi,

I have written an MFC DLL (not an extension DLL) that uses the shared
DLL version of MFC 4.0 (under Visual C++ 4.0). This DLL is being
called from a non-MFC C program through an entry-point in the MFC DLL.

In this DLL I have a dialog that I want to display. Unfortunately the

Ian Long

unread,
Jun 10, 1996, 3:00:00 AM6/10/96
to

I believe that that is one of the functions that you cannot call if you
are using the dll version of MFC. There is a technote describing the
other MFC functions that you cannot call...

> cli...@absa.co.za (Clifford Smith) wrote in article

<31bbbac6....@hermes.is.co.za>...

0 new messages