| Author |
One invoke another one but cant active it
|
endswel shui
Ranch Hand
Joined: Jul 03, 2008
Posts: 33
|
|
One invoke another one but cant active it
There is a case, using one java app (name app1) to invoke the other one (name app2),
app2 is hide, cant see it in the desktop, but can see it in the system tray.
now if I want to use app1 to invoke app2 and active it to show in the desktop,
I cant do it.
|
 |
Riaan Nel
Ranch Hand
Joined: Apr 23, 2009
Posts: 157
|
|
|
If you mean that you'd like to open something from the system tray, I doubt that you'll be able to do it using pure Java. As far as I know, Java can't interact with the operating system on that level.
|
"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." - George Bernard Shaw
|
 |
endswel shui
Ranch Hand
Joined: Jul 03, 2008
Posts: 33
|
|
no, just app2
I can using the exe4j ( the one instane properties) to pakcage app2
and using the image_name or pid find it,
but cant make the app2 show in the desktop if app2 is in the system tray
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Since the other application is not part of the same JVM you definitely have to use JNI (or JNA) for this.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
endswel shui
Ranch Hand
Joined: Jul 03, 2008
Posts: 33
|
|
Rob Spoor wrote:Since the other application is not part of the same JVM you definitely have to use JNI (or JNA) for this.
hi Rob Spoor
but how, do you have some experience (like code, etc.) to share.
how to handle the handle?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
To go through all the windows, you need native function "EnumWindows".
To go through all the processes, you first need to make a snapshot using "CreateToolhelp32Snapshot, then call "Process32First" once followed by "Process32Next" for all the remaining processes.
Check out Microsoft's MSDN site for more information and some examples.
|
 |
endswel shui
Ranch Hand
Joined: Jul 03, 2008
Posts: 33
|
|
Rob Spoor wrote:To go through all the windows, you need native function "EnumWindows".
To go through all the processes, you first need to make a snapshot using "CreateToolhelp32Snapshot, then call "Process32First" once followed by "Process32Next" for all the remaining processes.
Check out Microsoft's MSDN site for more information and some examples.
hi, Rob
Thank you for your answer, I follow it and implement the result what I want,
there is another issue,
for the app2, when it is activated from the system tray by the app1.
How could I hide the system tray, (because if the app2 shows itself in the desktop, it's system tray will be hide)
I try using the ShowWindow and FindWindow in the jpa under the User32, but FindWindow cant find it. --!
so, is there any method to solve this?
|
 |
endswel shui
Ranch Hand
Joined: Jul 03, 2008
Posts: 33
|
|
endswel shui wrote:
Rob Spoor wrote:To go through all the windows, you need native function "EnumWindows".
To go through all the processes, you first need to make a snapshot using "CreateToolhelp32Snapshot, then call "Process32First" once followed by "Process32Next" for all the remaining processes.
Check out Microsoft's MSDN site for more information and some examples.
hi, Rob
Thank you for your answer, I follow it and implement the result what I want,
there is another issue,
for the app2, when it is activated from the system tray by the app1.
How could I hide the system tray, (because if the app2 shows itself in the desktop, it's system tray will be hide)
I try using the ShowWindow and FindWindow in the jpa under the User32, but FindWindow cant find it. --!
so, is there any method to solve this?
I fail of this icon hide
I find the reason maybe to change the Shell_NotifyIcon()
but it is not very easy to write using jna. I dont know why, maybe some loss.
--!
|
 |
 |
|
|
subject: One invoke another one but cant active it
|
|
|