1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| #include "stdafx.h"
#include "comp-impl.h"
NS_IMPL_ISUPPORTS1(CSpecialThing, ISpecialThing)
CSpecialThing::CSpecialThing()
{
/* member initializers and constructor code */
mName.Assign(L"Default Name");
}
CSpecialThing::~CSpecialThing()
{
/* destructor code */
}
/* long add (in long a, in long b); */
NS_IMETHODIMP CSpecialThing::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval)
{
typedef char* (_stdcall *ProcDllPtr)(char* monString);
HMODULE hinstDLL=LoadLibrary((LPCSTR)"C:\\_projet\\TestDll\\DDLL.dll");
if (hinstDLL) {
ProcDllPtr ProcExportDll = (ProcDllPtr) GetProcAddress(hinstDLL, "MaFonction");
char* reponseDLL=ProcExportDll("sanctification personnel");
AfxMessageBox((LPCTSTR)reponseDLL,MB_OK,-2);
} else {
AfxMessageBox((LPCTSTR)"et m...",MB_OK,-2);
}
FreeLibrary((HINSTANCE)hinstDLL);
*_retval = a + b;
return NS_OK;
} |
Partager