Getting information of another window in java...
I was wondering if Java has the ability to get information from another window. I was using a program called AutoIt v3 Active Window Info, and it gets different information from a window such as the buttons and text fields in the window. I've included a couple of pictures to demonstrate it doing this.
http://www.koozieclub.com/java/windowinfo1.jpg
http://www.koozieclub.com/java/windowinfo2.jpg
Anyone have any ideas on how to do this in Java? Thanks
Re: Getting information of another window in java...
I don't believe its possible to do this unless you use JNI.
Re: Getting information of another window in java...
So I would have to use JNI and c++ or something?
Re: Getting information of another window in java...
You could certainly do it using JNI and C++ to the Windows SDK.
Re: Getting information of another window in java...
Isn't creating bots for the purpose of online gambling illegal?
Re: Getting information of another window in java...
This is the first time I've tried messing with JNI, so from what I read I tried through together some code. I first tested out the Hello world idea and that worked fine for me. Then II took my code that worked in C++ and tried to use it with JNI, and got some errors. Here's my code, followed by the errors...
Code:
POINT pt;
pt.x=200;
pt.y=570;
int nMaxCount = 10;
char buff[20];
HWND hWndParent;
hWndParent = WindowFromPoint(pt);
if(GetWindowText(hWndParent, buff, nMaxCount))
printf("%s",buff);
else
printf("null");
Code:
HelloWorld.obj : error LNK2001: unresolved external symbol __imp__GetWindowTextA
@12
HelloWorld.obj : error LNK2001: unresolved external symbol __imp__WindowFromPoin
t@8
HelloWorldImp.dll : fatal error LNK1120: 2 unresolved externals
Is this just not supported in JNI or what? I'm totally lost here, so any help would be greatly appreciated. Thanks!
Re: Getting information of another window in java...
Does anyone have any experience with GetWindowText() and other functions of that sort with JNI?
Re: Getting information of another window in java...
Have you built a JNI DLL exporting the API functions you want to use?
Doing more things faster is no substitute for doing the right things...
S. R. Covey
Re: Getting information of another window in java...
That's when the compiler starts to whine at me...What's weird is when I try to compile the .cpp in Visual C++ it compiles fine, but when I try to compile in the command prompt using cl, it gives me those link errors