Solved

Using external DLL's

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
wait notify demo infinite loop 3 110
Line meaning 9 85
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 552
Is there a simple front-end menu system. 9 89
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

772 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