-
December 20th, 2012, 12:26 PM
#1
Rewriting a Win32 app using HINSTANCE to a Win32 console application
Hi Everyone,
First let me that the last time I did a Vc++ small utility prg is back in 1995.
Here is my situation:
I have a win32 app that uses HINSTANCE and the main.cpp looks like:
-----------------------
#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.
The TESTLIB.DLL is an external library that is supposed to be compiled in .NET.
Any help will be appreciated, if someone is interested to do the work for me, please PM me I can give you the source code and you can give me an estimate price.
Thanks
-
December 20th, 2012, 01:39 PM
#2
Re: Rewriting a Win32 app using HINSTANCE to a Win32 console application
I might have forgot something here but...
It should be just a matter of changing WinMain to a standard main and change the project settings to a console project.
-
December 20th, 2012, 04:43 PM
#3
Re: Rewriting a Win32 app using HINSTANCE to a Win32 console application
And change calls to 'MessageBox' to instead write to the output stream ("cout").
Viggy
-
December 21st, 2012, 01:03 PM
#4
Re: Rewriting a Win32 app using HINSTANCE to a Win32 console application
Someone said that this:
"The OCR component is a Win32 DLL, to which Mono can't do anything to run on Linux. Mono is a pure implementation of the MSIL and CIL on various platforms. I can't run native Win32 components on other platforms. For example, the code file you attached uses the LoadLibrary and GetProcAddress which are Windows API functions that won't execute on Linux.
Is it true ?
-
December 21st, 2012, 02:15 PM
#5
Re: Rewriting a Win32 app using HINSTANCE to a Win32 console application
Originally Posted by peterman
Someone said that this:
"The OCR component is a Win32 DLL, to which Mono can't do anything to run on Linux. Mono is a pure implementation of the MSIL and CIL on various platforms. I can't run native Win32 components on other platforms. For example, the code file you attached uses the LoadLibrary and GetProcAddress which are Windows API functions that won't execute on Linux.
Is it true ?
Mono allows you to run .net applications on Linux which doesn't have anything to do with running a native 32 app. What are you trying to do exactly?
-
December 21st, 2012, 02:49 PM
#6
Re: Rewriting a Win32 app using HINSTANCE to a Win32 console application
I have a webserver running on linux (running PHP), I need a handwriting recognition library to decode part of an image that is stamped with some handwriting characters, so I looked all over the internet and only found 2 third party libraries but they are only available as DLL so I need to find a way to use these DLL on linux. if it can not not be done, then I would need a win32 webapp that will run as a window service and that will listen on port XXX. I will be sending an HTTP POST (a JSON string that will contain the Image in BMP format encoded in Base64, with the command like "RecognizeLine,RecognizeWord" etc) and then the webapp will respond also in JSON format with the results.
I would prefer a console app that I will call via PHP from my webserver (send a JSON stream and getback a JSON response). I ratter not use wine.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|