Solved

MFC DLL (Urgent Again)

Posted on 2001-08-27
11
388 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
mkprasad earned 200 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.

733 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