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:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(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!
#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:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(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!