Java J-Link Creo Parametric 9.0.7.0 Convert/Get windows of Creo to move them in the screen with JNA
Good morning everyone, i'm using the java j-link kit asynchronously to automate some task of Creo Parametric 9.0.7.0 (Java11).
Is it possible get the window of Creo Parametric and convert to an HWND in JNA? My purpose is to move the windows of Creo Parametric in the screen and later resize them, i haven't finded a way to get the pointer to inizialize the HWND. Here is a part of my code ("mainCreoApplication" is a class that contain asyncConn Obj, the session obj and the windows management):
private static final User32 user32 = User32.INSTANCE;
private void getHWND(){
MainCreoApplication mainCreoApplication = null;
try {
mainCreoApplication = new MainCreoApplication();
} catch (jxthrowable e) {
throw new RuntimeException(e);
}
Pointer ptr = null;
try {
ptr = new Pointer(mainCreoApplication.getMyAsyncConn().GetSession().GetCurrentWindow().getptr());
} catch (jxthrowable e) {
throw new RuntimeException(e);
}
HWND hwnd = new HWND(ptr);
if (hwnd != null) {
user32.MoveWindow(hwnd, 500, 500,1000,600, true);
}
}
public interface User32 extends com.sun.jna.platform.win32.User32 {
User32 INSTANCE = Native.load("user32", User32.class);
HWND SetParent(HWND hWndChild, HWND hWndNewParent);
boolean MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, boolean bRepaint);
}
Am i in the right direction? Is there a better way to do it?
Regards
Noah

