Hi everyone.
I'm trying to make a program like a simplified version of ArtMoney (memory editor). I tried C/C++ and Java, and it seems to be easier (for me) with Java. I'm using JNA and I'm following stuff I've found online. However, it seems that everything I find online regarding JNA is for an older version of it.
Firstly, I downloaded jna.jar and jna-platform.jar from
here and added it to my project. Then, I tried:
Pointer process = kernel32.OpenProcess(bla, bla, bla);
Everywhere it seems that OpenProcess returns a Pointer, while NetBeans showed it returns a HANDLE. After a lot of wall banging, I realized the solution was quite simple (thanks autocomplete):
Pointer process = kernel32.OpenProcess(bla, bla, bla).getPointer();
Now, I'm trying to use:
user32.GetWindowThreadProcessId(user32.FindWindowA(null, window), pid);
However, Netbeans says
cannot find symbol
symbol: method FindWindowA(<null>, String)
location: variable user32 of type User32
This is the name that I find everywhere on the internet. But NetBeans was saying it was wrong. Suspecting the method's name, I removed the "A" and found out that indeed that's what NetBeans considers correct. However, when I run the file ("Could not find the specified procedure" is a translation):
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'FindWindow': Could not find the specified procedure.
at com.sun.jna.Function.<init>(Function.java:208)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499)
at com.sun.jna.Library$Handler.invoke(Library.java:199)
at com.sun.proxy.$Proxy1.FindWindow(Unknown Source)
at main.Main.getProcessId(Main.java:23)
at main.Main.main(Main.java:34)
Java Result: 1
Suspecting that NetBeans was having trouble with the library, I tried compiling with the "A" back in the name. As I suspected:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
at main.Main.getProcessId(Main.java:23)
at main.Main.main(Main.java:34)
Java Result: 1
Then I went to the library's
Javadocs. The correct method's name is "FindWindow", and I found no mention to a deprecated "FindWindowA" neither anything useful. Further searches resulted nothing.
Regarding the questions
here under
Community and Support:
• Windows 7 Ultimate / Intel Core i3-2100 / 64 bit
• I don't think it applies.
• I don't think it applies either.
• None.
• In the text above.
So, what do I do to make FindWindow work?
Thanks in advance.