how can I use AfxLoadLibrary?

Started by
3 comments, last by jimywang 19 years, 3 months ago
I am trying to call a win32 dll from a MFC dll.In my program,I included stdafx.h which is created by visual studio,and I still get compiler error AfxLoadLibrary is not defined.Can somebody give me some advise pls?thanks in advance.
Advertisement
Hello,

For a reason I don't fully understand, it seems that AfxLoadLibrary() is only used when AFXDLL is declared - ie you are using the DLL version of the MFC. I suggest you to create a blank project (MFC app with shared MFC dll) and to test wether you can call it or not.

Another solution may be to use the ::LoadLibrary() API (the first parameter can be either NULL or ::GetModuleInstance(NULL)).

HTH,
I actually tried LoadLibrary() function.but for some reason,it doesnt work.I used ShowLastError,it says "The operating system cannot run".Does it mean I have some problem in my dll?
Hi again,

< kidding >
Of course, If the OS cannot run, then there should be something wrong.
< /kidding >

Where does this ShowLastError() come from? Do you mean GetLastError()? What is the numeric return of GetLastError()?

Regards,
thanks for helping.yeah I meant GetLastError.and I format them into string.and it says "the operating system cannot run"

This topic is closed to new replies.

Advertisement