Solved

Using external DLL's

Posted on 1998-10-22
2
172 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

14 Experts available now in Live!

Get 1:1 Help Now