title: rewrite a Win32 app using HINSTANCE to a Win32 console application
body: <p>I have a win32 app that uses HINSTANCE.
  Here is the main.cpp:</p>
  
  <pre><code>#include "stdafx.h"
  #include "testlib.c"
  
  int APIENTRY WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR     lpCmdLine,
                   int       nCmdShow)
  {   
  LoadTestLibrary(); 
      // etc....
  }
  </code></pre>
  
  <p>the testlib.c looks like this:</p>
  
  <pre><code>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...
  }
  </code></pre>
  
  <p>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.</p>