Solved

Any way of running a Java application within a C++ .scr Screesaver?

Posted on 2003-12-04
3
221 Views
Last Modified: 2010-04-02
Hello all,

I am about to write a screensaver in C++ (that will hopefully end up being all encapsulated in one .scr file) and my question is...

How do I incorporate a Java application into it?

As in - the screensaver will use a spider that I am writing in Java which will retrieve information that the screensaver will display. So can all this happen from within the .scr file? And if so, are there any extra requirements that the user would have to be aware of?

Thanks very much for your time,

Mark.
0
Comment
Question by:shifty_mc
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 9877653
You can alway run any Java program from a screensaver like any regular program - all you have to do is pecifying the VM on the command line, e.g.

BOOL Execute ( LPCTSTR pszCmd)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory ( &si, sizeof ( STARTUPINFO));

si.cb = sizeof ( STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;

DWORD bRes = CreateProcess ( NULL,
pszCmd
NULL,
NULL,
TRUE,
NORMAL_PRIORITY_CLASS,
GetEnvironmentStrings (),
NULL,
&si,
&pi
);
return ( bRes);
}

and use it like

Execute("java -cp c:\\projects\\helloworld helloworld");
0
 

Author Comment

by:shifty_mc
ID: 9878634
ok, thanks, but you've gone over my head a bit - i'm a bit rusty at the moment and will be learning on the job i feel.

So what did you mean by on the command line? As in I take it the bottom line is the actual one to start the java program from within C++ but what about the top stuff - not entirely sure what that's doing or where it's supposed to go.

Also on a tangent - to what extent could the java program communicate with the C++? Could it (Java) tell it (C++) to stop the screensaver for instance?

Thanks a lot - appreciate it.
0
 
LVL 5

Expert Comment

by:migoEX
ID: 10364882
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept jkr's comment as answer.

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

migoEX
EE Cleanup Volunteer
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now