Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Creating a DLL that uses MFC

Posted on 2006-06-15
4
213 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 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