Solved

Using external DLL's

Posted on 1998-10-22
2
221 Views
Last Modified: 2013-11-20
I am quite new to MFC, i usually program in Visual Basic. In VB it is very easy to use external dll's, you just need the dll and you need to know which functions the dll implements. But how do you use external dll's in MFC, do you need the .h and the .lib file for the dll in order to use it in your program?? And does the dll have to be a MFC dll?? I've heard something about LoadLibrary, but wouldn't know exactly how to use it! I mean if you can do it in BV without .h and .lib files surely you can do it MFC without those files! btw, i am using VC++ 6.0!

Of course some sample code would be nice!
0
Comment
Question by:thomasschmidt
2 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
ID: 1323738
In MFC you have to do it like this... (excuse me if the function var decl is a little rusty...)

HINSTANCE MyDLLHandle;
int (*)(int, int) MyFunc; // MyFunc is pointer to func returning int taking two int args

MyDLLHandle = LoadLibrary('MyDLL.DLL');
MyFunc = GetProcAddress(MyDLLHandle, 'MyFunc');

Cheers,

Raymond.

0
 

Author Comment

by:thomasschmidt
ID: 1323739
That has got to be the weirdest declaration i have ever seen ;-)! Is that the way it works in MFC??? It looks understandable now all i have to do is try it!

Thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
only14 challenge 19 64
no14 challenge 14 57
isEverywhere  challenge 19 64
canBalance challenge 34 65
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now