java - How can I read the window title with JNI or JNA? -


Want to come back to the development place; Mainly to call some native Win32 functions using Java (I do not want to build in .NET) ....

Can someone tell me where that place is a differnt Using Java (JNI / JNA / SWIG), you can read the title from the running window, assuming that you are trying to hook into a memory space, you will know where.

In JNA:

  increases the public interface User32 StdCallLibrary { User32 INSTANCE = (User32) Native.loadLibrary ("user32", User32.class); Int GetWindowTextA (pointer type hWnd, byte [lpString, int nMaxCount]; }  

To use it:

  byte [] windowText = new byte [512]; Pointer type hwnd = ... // handle the window here. User32.INSTANCE.GetWindowTextA (HWD, window text, 512); Println (Native.toString (windowText));  

You probably want to use proper structure mapping for HWND and also allow Unicode support; How can you find that information and more examples on it.

The document for GetWindowText function is available here.

Document for JNA

is available


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -