Solved

Using external DLL's

Posted on 1998-10-22
2
173 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!
0
Comment
Question by:thomasschmidt
2 Comments
 
LVL 1

Accepted Solution

by:
Bridge earned 100 total points
ID: 1323736
HINSTANCE hDLL;               // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1;    // Function pointer
DWORD dwParam1;
UINT  uParam2, uReturnVal;

hDLL = LoadLibrary("MyDLL");

if( hDLL != NULL )
{
   lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL, "DLLFunc1" );

if( lpfnDllFunc1 )
   uReturnVal = lpfnDllFunc1(dwParam1, uParam2);

FreeLibrary(hDLL);

0
 

Author Comment

by:thomasschmidt
ID: 1323737
somehow this question got posted twice, but i'll give you the points anyway(even though there are errors in the code)!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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. …
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.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

25 Experts available now in Live!

Get 1:1 Help Now