Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MFC DLL (Urgent Again)

Posted on 2001-08-27
11
Medium Priority
?
395 Views
Last Modified: 2006-11-17
can anyone post a sample MFC DLL, and an application calling it?  Please post a working sample.  Thanks!
0
Comment
Question by:aztecs00
[X]
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
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6428213
I suppose someone could but your track record here on EE indicates that you are quite hostile to experts who try to help you out.  Your feedback profile shows:

Last 10 Grades Given: B C B  

You seem to enjoy giving out poor grades rather than working with the experts to get the information you need.

0
 
LVL 32

Expert Comment

by:jhance
ID: 6428219
Not only that, but you also seem to have a bad habit of leaving unresolved questions here:

This one from way back in January 2001:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=security&qid=20060150


And this one from June 2001:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=webdevgen&qid=20143116
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6428262
Are you just looking for an example of how to call functions in a DLL from an MFC app?

Are you looking for extensions to MFC?

Does the DLL have to use MFC functions?

If it calls AfxMessagebox, does that suffice?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Accepted Solution

by:
mkprasad earned 800 total points
ID: 6429093
////// The following is the DLL portion!
//////File : TestDLL.h
#ifdef TESTDLL_EXPORTS
#define TESTDLL_API __declspec(dllexport)
#else
#define TESTDLL_API __declspec(dllimport)
#endif

// This class is exported from the TestDLL.dll
class TESTDLL_API CTestDLL {
public:
     CTestDLL(void);
     char* My_Func();
     // TODO: add your methods here.
};

extern TESTDLL_API int nTestDLL;

TESTDLL_API int fnTestDLL(void);

//////File : // TestDLL.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "TestDLL.h"

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                          )
{
    switch (ul_reason_for_call)
     {
          case DLL_PROCESS_ATTACH:
          case DLL_THREAD_ATTACH:
          case DLL_THREAD_DETACH:
          case DLL_PROCESS_DETACH:
               break;
    }
    return TRUE;
}


// This is an example of an exported variable
TESTDLL_API int nTestDLL=0;

// This is an example of an exported function.
TESTDLL_API int fnTestDLL(void)
{
     return 42;
}

// This is the constructor of a class that has been exported.
// see TestDLL.h for the class definition
CTestDLL::CTestDLL()
{
     return;
}

char* CTestDLL::My_Func()
{
     return "My Name is MKPrasad";
}

////////// This is an application using the above dll.
///////// Dont forget to include the TestDLL.LIB

#include "../TestDLL.h"
#include <iostream.h>

int main(int argc, char* argv[])
{
     cout <<fnTestDLL() << endl;
     CTestDLL testDll;
     cout << testDll.My_Func() << endl;
     return 0;
}

0
 
LVL 32

Expert Comment

by:jhance
ID: 6429110
mkprasad,

By all means!  Encourage this user's poor behavior!
0
 

Expert Comment

by:mkprasad
ID: 6429227
This is not to encourage him,
He might be in need....
and anyway you have warned him about his bad behaviour!
As an expert(adult)he must have received it in proper sense.
What do u say Mr.aztecs00?
0
 
LVL 32

Expert Comment

by:jhance
ID: 6429248
>>He might be in need....

If he's in need why does he:

1) Give experts "C" grades rather than asking for more information.

2) Leave questions hanging without resolution.

Takeing care of either of the above costs NOTHING.  But leaving them takes advantage of experts time and effort.
0
 

Author Comment

by:aztecs00
ID: 6430336
thanks mkprasad!  I am really in need.  

jhance, sorry for my "poor behavior".  Let me give you my side of the story... for the grades, well, I ask questions clearly, but then, in the end, the answers I got were just part of the entire solution.  I can't give out an A when I get errors on their suggested solutions, or when I don't get satisfied with the answers I need, right?  However, as some sort of gratitude, I give higher points as a reward.  Now, the unresolved questions are my fault.  I would resolve it immediately.

0
 
LVL 2

Expert Comment

by:ssr
ID: 6430667
Another way to get at the answer you seek, is to create a new MFC DLL App Wizard project.  Select File, New, click on the Projects tab, select MFC DLL App Wizard, enter a name, and click Ok.  Then, click Finish, click Ok, and you have a standard MFC DLL project.

SSR
0
 

Author Comment

by:aztecs00
ID: 6434687
Now that's an answer!  I did get some errors though, but I could get around it. :)
0
 

Expert Comment

by:mkprasad
ID: 6435651
thax aztecs00.
As we work in two diff environment settings,obviously small
errors might be generated like including stdAfx.h,iostream.h with or with out namespace etc!!

i should also say thanks to jhance!
:-)MK
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

688 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