Posted By:
suryakanth_koppera
Posted On:
Friday, August 2, 2002 07:34 AM
If I understand what u want is to invoke the main method of C++ from Java. I did this in my way if it works for u that will be good. What i did was I created a dll in in c++ and loaded in java. From java I am invoking the Native method called.See the code below.
JNIEXPORT void JNICALL Java_Native_Hello(JNIEnv *env, jobject obj)
{
int k = WinMain(hcur,hpre,cmdline,cmshow);
return;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
HACCEL hAccelTable;
sprintf(szWindowClass,"%s","SURYA");
sprintf(szTitle,"%s","SURYA");
MyRegisterClass(hInstance);
if(!InitInstance(hInstance,nCmdShow)){
return 1;
}
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
The parameters I passed to WinMain(hcur,hpre,cmdline,cmshow)
are declared globally in c++. This worked for me hope it will work for u too.
surya