Advertisement

Call function from MFC Dll from a MFC app

Started by May 13, 2001 09:07 PM
0 comments, last by Kayan 23 years, 9 months ago
Ok here''s the problem, it surely a dumb question. but anyway. I want to call a function that is inside a MFC dll from a MFC application. Is there any place in the world which I could find the answer or it''s just impossible!? Doesn''t seem to have any good reference on any web site. P.S. I really hope that someone has the answer to it because it''s begin to drive me crazy. Thanks.
Not sure I understand what you are asking.

You static-ly link a dll into your app by including the corresponding .lib file in the program list or link settings, then you add the include file in the code you want to use it in, then you just call the function. Doesn''t matter if the dll is MFC or not they both work the same.

If you have only a dll, and no .lib or .h file, then your options are very limited. You have to query the dll to find out what functions are available for you to call. Of course that is after you use LoadLibrary to dynamically load the thing. If you know the name of a function you want to call, then you can use MakeProcAddress to create a pointer-to-function that you can then use to make the call. Pretty complicated - I avoid doing it that way if at all possible. Again, the dynamic loading works the same way for mfc and non mfc dlls.

Hope this helps

Douglas Sutherland


This topic is closed to new replies.

Advertisement