Click here to Skip to main content
15,890,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How do I subscribe to events in a class? Pin
Matthew Faithfull19-Nov-07 5:03
Matthew Faithfull19-Nov-07 5:03 
GeneralRe: How do I subscribe to events in a class? Pin
arnold_w19-Nov-07 22:11
arnold_w19-Nov-07 22:11 
QuestionBeginner Pin
john563219-Nov-07 2:09
john563219-Nov-07 2:09 
AnswerRe: Beginner Pin
Kerem Guemruekcue19-Nov-07 2:40
Kerem Guemruekcue19-Nov-07 2:40 
AnswerRe: Beginner Pin
Johpoke19-Nov-07 2:44
Johpoke19-Nov-07 2:44 
AnswerRe: Beginner Pin
chandu00419-Nov-07 3:02
chandu00419-Nov-07 3:02 
AnswerRe: Beginner Pin
Hamid_RT19-Nov-07 3:48
Hamid_RT19-Nov-07 3:48 
QuestionHow do I call an instance method from an exported method in a MFC DLL? Pin
arnold_w19-Nov-07 0:24
arnold_w19-Nov-07 0:24 
I have created a dll in MFC using the Visual Studio wizard and the dll exports a function called MyExportedMethod:

#include "stdafx.h"
#include "DllProblem.h"

BEGIN_MESSAGE_MAP(CDllProblemApp, CWinApp)
END_MESSAGE_MAP()

CDllProblemApp::CDllProblemApp()
{
}

CDllProblemApp theApp;

BOOL CDllProblemApp::InitInstance()
{
CWinApp::InitInstance();
return TRUE;
}

double _stdcall MyExportedMethod(double param)
{
// Here I would like to call the
// MethodIwouldLikeToInvoke method in class MyClass.
// How do I do that???

return 0;
}

I would like the MyExportedMethod method to invoke a (non-static) method in a class called MyClass:

#include "stdafx.h"
#include "DllProblem.h"
#include "MyClass.h"

IMPLEMENT_DYNAMIC(MyClass, CDialog)

MyClass::MyClass(CWnd* pParent /*=NULL*/): CDialog(MyClass::IDD, pParent)
{
}

MyClass::~MyClass()
{
}

void MyClass::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(MyClass, CDialog)
END_MESSAGE_MAP()

void MyClass::MethodIwouldLikeToInvoke()
{
MessageBox(L"Congratulations! The exported method successfully invoked the correct method!");
}

What should I add to successfully invoke the MethodIwouldLikeToInvoke from the MyExportedMethod method? This may seem like a simple problem and that is ok, this is not a trick question (I'm a beginner C++ programmer). Thank you in advance!
GeneralRe: How do I call an instance method from an exported method in a MFC DLL? Pin
Matthew Faithfull19-Nov-07 0:32
Matthew Faithfull19-Nov-07 0:32 
GeneralRe: How do I call an instance method from an exported method in a MFC DLL? Pin
arnold_w19-Nov-07 1:02
arnold_w19-Nov-07 1:02 
QuestionRe: How do I call an instance method from an exported method in a MFC DLL? Pin
Matthew Faithfull19-Nov-07 1:07
Matthew Faithfull19-Nov-07 1:07 
AnswerRe: How do I call an instance method from an exported method in a MFC DLL? Pin
arnold_w19-Nov-07 2:09
arnold_w19-Nov-07 2:09 
QuestionAbout Socket Buffer Pin
manish.patel19-Nov-07 0:12
manish.patel19-Nov-07 0:12 
GeneralRe: About Socket Buffer Pin
Matthew Faithfull19-Nov-07 0:36
Matthew Faithfull19-Nov-07 0:36 
GeneralRe: About Socket Buffer Pin
manish.patel19-Nov-07 0:50
manish.patel19-Nov-07 0:50 
GeneralRe: About Socket Buffer Pin
Matthew Faithfull19-Nov-07 1:03
Matthew Faithfull19-Nov-07 1:03 
GeneralRe: About Socket Buffer Pin
manish.patel19-Nov-07 1:10
manish.patel19-Nov-07 1:10 
AnswerRe: About Socket Buffer Pin
Matthew Faithfull19-Nov-07 1:22
Matthew Faithfull19-Nov-07 1:22 
GeneralRe: About Socket Buffer Pin
Mark Salsbery19-Nov-07 6:36
Mark Salsbery19-Nov-07 6:36 
GeneralRe: About Socket Buffer Pin
Mark Salsbery19-Nov-07 6:40
Mark Salsbery19-Nov-07 6:40 
GeneralRe: About Socket Buffer Pin
Matthew Faithfull19-Nov-07 8:14
Matthew Faithfull19-Nov-07 8:14 
GeneralRe: About Socket Buffer Pin
Mark Salsbery19-Nov-07 8:24
Mark Salsbery19-Nov-07 8:24 
QuestionTemplate without any content Pin
George_George18-Nov-07 23:57
George_George18-Nov-07 23:57 
AnswerRe: Template without any content Pin
Nelek19-Nov-07 0:25
protectorNelek19-Nov-07 0:25 
GeneralRe: Template without any content Pin
George_George19-Nov-07 1:04
George_George19-Nov-07 1:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.