java - Createwindowex invalid handle error -


i using jna functions 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 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 getting error_invalid_handle error. wrong code.

thanks

there lot of problems code. don't perform error checking, has been exhaustively covered in comments. need sort out.

you use magic constants window style. please declare named constants future readers (i.e. you) can make sense of code. key 1 use of ws_child. can't make desktop window parent of child window. you'll need provide window parent.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -