If handle.IsInitialized Then
Sleep(0)
Dim awtrec As JavaObject = GetPosSizeWindow(handle)
Log(awtrec)
If awtrec.IsInitialized Then
Dim xpos As Int = awtrec.GetField("left") '+ xxxx For Move to x
Dim ypos As Int = awtrec.GetField("top") ''+ yyyy For Move to y
Dim width As Int = awtrec.GetField("right").As(Int)-awtrec.GetField("left").As(Int) 'actual size
Dim height As Int = awtrec.GetField("bottom").As(Int)-awtrec.GetField("top").As(Int) 'actual size
MuoviWindow(handle,xpos,ypos,width,height,False)
End If
End If
Sub GetPosSizeWindow(handle As JavaObject) As JavaObject
Return Me.as(JavaObject).RunMethod("GetInfoWindow", Array(handle))
End Sub
Sub MuoviWindow(handle As JavaObject, x As Int, y As Int, w As Int, h As Int, refresh As Boolean) As Boolean
Return Me.as(JavaObject).RunMethod("MoveWindow", Array(handle,x,y,w,h,refresh))
End Sub
#if Java
import com.sun.jna.Native;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinDef.RECT;
import com.sun.jna.platform.win32.WinUser;
import com.sun.jna.win32.StdCallLibrary;
public static RECT GetInfoWindow(WinDef.HWND hwnd){
try{
RECT rect = new RECT();
User32.INSTANCE.GetWindowRect(hwnd, rect);
return rect;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
#End If
#if Java
import com.sun.jna.Native;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinUser;
import com.sun.jna.win32.StdCallLibrary;
public static boolean MoveWindow(WinDef.HWND hwnd, int x, int y, int w, int h, boolean refresh){
try{
User32.INSTANCE.MoveWindow(hwnd, x, y, w, h, refresh);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
#End If