Skip to main content
GameDev.net gamedev.net
🔒 Locked

howto get Window ID using JAVA?[SOLVED]

Started by Mardigin Jun 1, 2005 at 11:05 PM 2 replies 2.5k views
Original Post
Mardigin
Mardigin
In C++ there is a function that is similar, if not identical, to GetWindowID(hwnd). It can be used to get another Windows ID; this includes windows that are children of other applications. Are there any classes that have such a member function in JAVA? Specifically what I want to accomplish is this. There is an application that can conflict with my application but only under cirtain circumstances. I want to be able to identify and control, or avoid, those circumstances. If I can obtain a handle to the window of this application and also its children so that I may obtain their titles, ID's, and demensions then I will be able to avoid the conflict. Any suggestions? Mardigin. [Edited by - Mardigin on June 2, 2005 12:51:04 PM]
BitMaster
BitMaster
First: It's Java. It's a name, not an acronym.
Second: I can't say I see any way to do this from plain Java Code (nor a sensible explanation why something like that should be exposed). I'm pretty sure you can gain access to the window handle via JNI though.
OrangyTang
OrangyTang
1. This won't be possible without some use of (platform specific) JNI calls.

2. This sounds like a nasty hack to work around something thats broken rather than fixing it properly. If its a problem with your app, fix it. If not then bitch at the author of the other app and write a warning to users of your app.
Mardigin
Mardigin
Thanks OrangyTang and BitMaster.

You were both right about that JNI calls. I managed to put together a workable solution and you are both right about it being a less than ideal solution. However, the authors of the other application will not budge and I of course do not have access to the source code to make the change myself. For now this will do.

Thank you.

Mardigin.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.