|
|
I dont wanna call c++ function from java but wanna call jar file from visual c++. BTW, thank you for your reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: For one of my projects I need to call jar files from the visual c++ application
If you just want to unpack the jar file then use ShellExecute .
Prepare a command string like "Cmd.exe YourJarFilePath.jar -Arg1 - Arg2" , then pass it to ShellExecute .
|
|
|
|
|
This might be a bit helpful. Can you send me a sample code say I want to call a jar file at location C:\psae.jar with the parameter "world" then the syntax from command prompt is :
java -jar C:\psae.jar world
How the command string should look like for this one ?
Thanks for your reply
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: java -jar C:\psae.jar world
So in this case the command will be the same...
Look up ShellExecute in MSDN .
The lpFile parameter should be "java.exe" and lpParameters should be "-jar C:\psae.jar world".
|
|
|
|
|
Thanks Dear friend. It really will help a lot.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: It really will help a lot.
Did it work.
|
|
|
|
|
It didn't work. When I use debuger, it shows me the return value of the shellexecute as 2 and the value for getlasterror is the same. I dont knokw how to deal this ?
I am using the following code snippet :
HINSTANCE hInst;<br />
hInst= ShellExecute(NULL,reinterpret_cast<LPCWSTR>("open"),reinterpret_cast<LPCWSTR>("C:\j2sdk1.4.2_12\bin\java.exe"),reinterpret_cast<LPCWSTR>("-jar C:\psae.jar WORLD"),NULL,SW_SHOWMAXIMIZED);<br />
and even try with this one :
hInst= ShellExecute(NULL,reinterpret_cast<LPCWSTR>("java"),reinterpret_cast<LPCWSTR>("C:\j2sdk1.4.2_12\bin\java.exe"),reinterpret_cast<LPCWSTR>("-jar C:\psae.jar WORLD"),NULL,SW_SHOWMAXIMIZED);<br />
both shows the same error.
Error no. 2.
|
|
|
|
|
Why all of the reinterpret_cast() code? Aren't you forgetting to use double backslashes in your string literals?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I didn't get the point you raised. Can you explain me that with some example ?
Thanks for your reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
What's not to understand?
HINSTANCE hInst = ShellExecute(NULL, "open", "C:\\j2sdk1.4.2_12\\bin\\java.exe", "-jar C:\\psae.jar WORLD", NULL, SW_SHOWMAXIMIZED); If you are using Unicode, just precede the string literals with an L .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Got it. Thanks to remind me about that. Can you help me how can i send a java command to command prompt through visual c++. I want to unpack a jar file which can be done from command prompt by passing a command like :
java -jar C:\myfile.jar para
Appreciate your advice.
Nikhs
Nikhil Trivedi
|
|
|
|
|
I got the jar files executed from visual c++. But If I want the return value of the jar file into the visual C++ application, how can I get it ? Does anyone know about it then please help me.
Appriciate your help.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: But If I want the return value of the jar file into the visual C++ application, how can I get it ? Does anyone know about it then please help me.
See here and here. Using these examples, you should be able to get the output of java.exe.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello dear friend,
It worked. Now I want to call a function from the jar file and want its return value in the calling visual c++ application. Do you know how to do this ?
Any help or advice is appriciated.
Nikhs
Nikhil Trivedi
|
|
|
|
|
hi
I am still a beginner but I should use a owner-draw tab control in my project,though it is a hard topic for me.My question is that how can I change the color of the title buttons of a Tab control?Is there anybody who knows the answer and wants to answer?
Thanks
-- modified at 8:12 Tuesday 24th April, 2007
|
|
|
|
|
Did you see tab section on the codeproject it has articles about this subject
|
|
|
|
|
Hi, just wrote a message but I don't get a solution to my problem so I retry:
I need to manage an ActiveX component created on the mainWnd of my App, into a thread.
In particular I need to fill a grid (as I just said, created in the MainWnd) from a thread (on the Run() function), so while the app go on.
I pass to the thread the grid's pointer but at run time an Error messageBox appears that say "Invalid pointer value".
How can I solve it?
Thanks.
|
|
|
|
|
Hiii all,
I need to make text bold in a read only edit control .Can u suggest me how to do this
Thanks
|
|
|
|
|
Try this
CFont font;
VERIFY(font.CreateFont(
12,
0,
0,
0,
FW_NORMAL,
FALSE,
FALSE,
0,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,
"Arial"));
m_cEdit.SetFont(&font);
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
vibindia wrote: FW_NORMAL, // nWeight
You want to say FW_BOLD , isn't it?
Prasad
MS MVP - VC++
|
|
|
|
|
ya in nWeight the Boldness has to be given
Constant Value
FW_DONTCARE 0
FW_THIN 100
FW_EXTRALIGHT 200
FW_ULTRALIGHT 200
FW_LIGHT 300
FW_NORMAL 400
FW_REGULAR 400
FW_MEDIUM 500
FW_SEMIBOLD 600
FW_DEMIBOLD 600
FW_BOLD 700
FW_EXTRABOLD 800
FW_ULTRABOLD 800
FW_BLACK 900
FW_HEAVY 900
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
FW_BOLD in place of FW_NORMAL will do. Why would you suggest FW_NORMAL for some who wants to render bold text?
found at bash.org
[kernx]|.|.|.|.|.|.|.|
[kernx]sorry, wrong window
[beox33]say me why in the f*ck will you type that in any window
|
|
|
|
|
brahmma wrote: Why would you suggest FW_NORMAL for some who wants to render bold text?
Yet another example of "failing to fully read the question."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for the suggestion.....
Here i want to change the font to bold only... other settings remaining the same.to use this i have to set all other parameters for which i donno the previous set values...
when i use this size of text .. and all other settings r getting changed...
how can i overcome this..
|
|
|
|