Hi to all
I have this code
In debug mode all work fine but with the compiled package the program crash.
Now I added this:
The program not crash but not work well.
Thanks for your advice.
I have this code
B4X:
'get windows open
Dim JO As JavaObject
Dim jo2 As JavaObject = JO.InitializeStatic("com.sun.jna.platform.win32.User32").GetField("INSTANCE") '<<<<<<
Dim hWnd As JavaObject = jo2.RunMethod("FindWindow", Array(Null, mapset.GetDefault("txtprg2titolo", "??"))) '
countgen = 0
Do While Not(hWnd.IsInitialized)
Dim hWnd As JavaObject = jo2.RunMethod("FindWindow", Array(Null, mapset.GetDefault("txtprg2titolo", "??")))
Sleep(0)
If hWnd.IsInitialized Or countgen >= 8 Then Exit
Loop
If hWnd.IsInitialized Then
Dim wu As JavaObject
wu.InitializeStatic("com.sun.jna.platform.WindowUtils") '<<<<<<
Dim awtrect As JavaObject = wu.RunMethod("getWindowLocationAndSize", Array(hWnd))
Dim xpos As Int = awtrect.GetField("x") + mapset.Get("txtprg2x").As(Int)
Dim ypos As Int = awtrect.GetField("y")+ mapset.Get("txtprg2y").As(Int)
Dim w As Int = awtrect.GetField("width")
Dim h As Int = awtrect.GetField("height")
jo2.RunMethod("SetWindowPos", Array(hWnd, Null, xpos, ypos, w, h, 0))
End If
In debug mode all work fine but with the compiled package the program crash.
Now I added this:
B4X:
#PackagerProperty: AdditionalModuleInfoString = uses com.sun.jna.platform.win32.User32;
#PackagerProperty: AdditionalModuleInfoString = uses com.sun.jna.platform.WindowUtils;
Thanks for your advice.