Solved

Creating a DLL that uses MFC

Posted on 2006-06-15
4
207 Views
Last Modified: 2010-04-01
I have never created a DLL before.  I am using MSVC++ 6.0.  I would like to create a new DLL that uses MFC.  What is the best way to do this.  I have tried creating a Win32 DDL and it is not obvious to me how I enable MFC support.
0
Comment
Question by:jribble
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
rajeev_devin earned 500 total points
ID: 16912578
Goto File > New > Projects > Select MFC AppWizard (dll).
And then give the project a name and click OK.
You MFC DLL base is ready.

good luck !
0
 
LVL 12

Assisted Solution

by:rajeev_devin
rajeev_devin earned 500 total points
ID: 16912604
If you just want to enable MFC in your Win32 DLL.
Then goto Project > Settings > General > I Microsoft Foundation Classes combo select
Use MFC in a Static Libray, or
Use MFC in a Shared Libray.

Your project is now MFC compatible.
0
 

Author Comment

by:jribble
ID: 16914595
Ok, that was easy enough.  Maybe its not fair to ask another question, but how do I add a class/function and make it available to my application?
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16917386
Put the declaration of the function or class in a header file.
Put the definition of the function or class in a source file.

In your application you need to include the header file.
#include "mydll.h"

In addition you will get a .lib file along with the .dll file.
In your linked settings add this .lib file to avoid linking error.

thats it.
good luck !
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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

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

19 Experts available now in Live!

Get 1:1 Help Now