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
| // simpledllcpp.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#ifdef _MANAGED
#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
HMODULE hinstDLL;
MessageBox(0,(LPCWSTR)"",(LPCWSTR)"",0);
hinstDLL=LoadLibrary((LPCWSTR)"SimpleDll.dll");
char *errorMessage;
if(::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,::GetLastError(),0,(LPTSTR)&errorMessage,0,NULL))
{
(void)MessageBox(0, (LPCWSTR)errorMessage,(LPCWSTR)"Erreur",MB_ICONERROR | MB_OK);
(void)LocalFree(errorMessage);
}
else
{
(void)MessageBox(0, (LPCWSTR)"Meme pas reussi a recuperer le message", (LPCWSTR)"Erreur", MB_ICONERROR | MB_OK);
}
FreeLibrary(hinstDLL);
return TRUE;
}
#ifdef _MANAGED
#pragma managed(pop)
#endif |
Partager