rewrite a Win32 app using HINSTANCE to a Win32 console application

204 Views Asked by At

I have a win32 app that uses HINSTANCE. Here is the main.cpp:

#include "stdafx.h"
#include "testlib.c"

int APIENTRY WinMain(HINSTANCE hInstance,
                 HINSTANCE hPrevInstance,
                 LPSTR     lpCmdLine,
                 int       nCmdShow)
{   
LoadTestLibrary(); 
    // etc....
}

the testlib.c looks like this:

HINSTANCE TESTLIB=NULL;

long LoadTestLibrary()
{
    TESTLIB=LoadLibrary("TESTLIB.DLL");
    if(TESTLIB == NULL)
{
MessageBox(NULL, "Unable to load TESTLIB.DLL", "ERROR", MB_OK);
    return(-1);
}
else
{
    // do some stuff...
}

What I want is rewrite the code in a win32 console app. all output will be echoed instead of messagebox. The reason I want a console app is because I need to compile it with mono and use it on a linux server.

0

There are 0 best solutions below