import win32.windows;
import std.stdio;
import std.string;
import core.runtime;

alias extern(Windows) int function( HWND a, immutable char* b, char* c, DWORD d ) CmdFuncT;

void main()
{
	for(;;) {
		write("> ");
		string s = readln();
		if(s.length > 0) {
			HINSTANCE h = cast(HINSTANCE) Runtime.loadLibrary("QBga32.DLL");
			CmdFuncT Bga = cast(CmdFuncT)GetProcAddress(h, "Bga");
			int r = Bga(NULL, s.toStringz(), null, 0);
			Runtime.unloadLibrary(h);
			writeln("Return: ", r);
		}
	}
}
