Solved

Using external DLL's

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 94
Get filename and folder into excel 7 79
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 811
modThree challenge 4 99
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: 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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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