#include <stdio.h>
#include <windows.h>
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
hInstance = LoadLibrary("dll.dll");
if(!hInstance)
{
MessageBox(NULL, "Couldn't get dll.dll", "Error", MB_OK | MB_ICONERROR);
return 1;
}
int (*MyFuncPtr)(int,int);
MyFuncPtr = (int(*)(int,int))GetProcAddress(hInstance,"MyFunc");
/* if(!MyFuncPtr)
{
MessageBox(NULL, "Error in DLL", "Error", MB_OK | MB_ICONERROR);
return 1;
}*/
int a = 1, b = 2;
int ret = MyFuncPtr(a,b);
char temp[99];
sprintf(temp, "Die value aus der DLl ist: %i", ret);
MessageBox(NULL, temp, "dll.dll", MB_OK | MB_ICONINFORMATION);
FreeLibrary(hInstance);
MessageBox(NULL, "Allright", "Allright", MB_OK | MB_ICONINFORMATION);
return 0;
}