I am using jna functions to call winapi
public muFunction(){
Magnification.INSTANCE.MagInitialize();
RECT desktopRect= new RECT();
HWND desktop = User32.INSTANCE.GetDesktopWindow();
User32Extra.INSTANCE.GetWindowRect(desktop, desktopRect);
HINSTANCE hInstance =Kernel32.INSTANCE.GetModuleHandle(null);
HWND lsm = User32Extra.INSTANCE.FindWindow(null, "MyWindow");
HWND hwndMag = User32Extra.INSTANCE.CreateWindowEx(new DWORD(0x00000000L), "Magnifier", "MagnifierWindow", new DWORD(0x40000000L|0x0001L|0x10000000L), desktopRect.left, desktopRect.top, desktopRect.right-desktopRect.left, desktopRect.bottom-desktopRect.top, desktop, null, hInstance, null);
System.out.println(Native.getLastError()); // return 6 as error
}
Magnification Api code
public interface Magnification extends StdCallLibrary {
Magnification INSTANCE = (Magnification) Native.loadLibrary("magnification", Magnification.class,
W32APIOptions.DEFAULT_OPTIONS);
public Boolean MagInitialize();
public boolean MagSetWindowFilterList(HWND hwndMag, DWORD dword, int i,
HWND[] excludeHWNDs);
public boolean MagSetWindowSource(HWND hwndMag, RECT sourceRect);
}
I am getting ERROR_INVALID_HANDLE
error. What is wrong with my code.
Thanks