Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why can't call a dll function in exe which start a thread?
#4
This macro creates almost the same program in C language. Does it work?

Requires QM 2.3.2.

Macro Macro1404
Code:
Copy      Help
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;
}


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)