[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

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

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
shifty_mc
Asked:
shifty_mc
1 Solution
 
jkrCommented:
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
 
shifty_mcAuthor Commented:
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
 
migoEXCommented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now