Solved

MFC DLL (Urgent Again)

Posted on 2001-08-27
11
375 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
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 32

Expert Comment

by:jhance
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Accepted Solution

by:
mkprasad earned 200 total points
Comment Utility
////// 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
Comment Utility
mkprasad,

By all means!  Encourage this user's poor behavior!
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Expert Comment

by:mkprasad
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
Now that's an answer!  I did get some errors though, but I could get around it. :)
0
 

Expert Comment

by:mkprasad
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

744 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

18 Experts available now in Live!

Get 1:1 Help Now