I have a java application that will run on Windows 7 (using Swing, App #1) that runs as full screen (but not in exclusive mode). I have another application (App #2) that displays a GUI to configure an external device over a serial port that I do not have the source to and cannot change at all.
I want to embed App #2 inside of App #1 so that it looks like it is part of the parent java application (hiding the file --> exit button and hiding the minimize, maximize, and close buttons).
If this kind of integration is not possible inside the Java application, I would be fine with opening the process using Java and just monitoring it to keep it open . It would need to keep the window set to "always on top" because App #1 is fullscreen and hide as much of the external MS Windows UI as possible to trick the user into thinking it isn't an external application. Is there some kind of method whether using JNI or something else to manage another processes window (screen location, title bar, minimize, maximize,开发者_运维技巧 close button visibility) and process state from inside my Java application?
I will be happy to provide more information if needed.
The following scheme is language independent, I've managed to embed IE window into a Ruby application this way:
First of all, change the style of the external application window (you can use JNA for calling WinAPI):
style = GetWindowLongPtr(APP_HWND, GWL_STYLE);
style |= WS_CHILD;
style &= ~WS_CAPTION;
style &= ~WS_POPUP;
SetWindowLongPtr(HWND, GWL_STYLE, style);
Define parent-child relationship between windows:
SetParent(APP_HWND, JAVA_HWND);
Listen to Move/Resize events of your Java window, and apply new positions on a child window.
精彩评论