06-17-2010, 07:04 PM
This macro creates almost the same program in C language. Does it work?
Requires QM 2.3.2.
Macro Macro1404
Requires QM 2.3.2.
Macro Macro1404
str se="$desktop$\test.exe"
__Tcc x.Compile("" se 1)
run se
#ret
#include <windows.h>
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HMODULE hm;
int (__stdcall*SetServer)(LPSTR,int);
int (__stdcall*StartEngine)();
int (__stdcall*StopEngine)();
int (__stdcall*GetEngineStatus)();
//if these functions use C calling convention (__cdecl), delete all __stdcall.
int r1=0, r2=0;
if(hm=LoadLibrary("III.dll"))
{
SetServer=GetProcAddress(hm, "SetServer");
StartEngine=GetProcAddress(hm, "StartEngine");
StopEngine=GetProcAddress(hm, "StopEngine");
GetEngineStatus=GetProcAddress(hm, "GetEngineStatus");
r1=SetServer("11.22.11.22", 12345);
r2=StartEngine();
}
char s[1000];
_snprintf(s, 999, "hm=%i r1=%i r2=%i", hm, r1, r2);
MessageBox(0, s, "test", MB_TOPMOST);
return 0;
}