I’m playing with a JFrame in Java. I want it to be the topmost window i.e. always on top. The setAlwaysOnTop() works fine, but as soon as I start a movie or a game-window in a full-screen mode then it fails to stay on top.
I played around with JNI and handles. My C code for JNI is using SetWindowPos() and this seems to be working OK until I start a full-screen app. Here’s a sample:
JNIEXPORT void JNICALL Java_Frame1_setWindowAlwaysOnTop
(JNIEnv *env, jclass obj, jint hwnd, jboolean flag)
{
if (flag)
SetWindowPos((HWND) hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
else
SetWindowPos((HWND) hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
return;
}
I’ve been googling for some time now and all I established is that the full-screen runs in an exclusive mode and “suspend the windowing system so that drawing can be done directly to the screen“.
Can anyone suggest a workaround? BTW. my C is not that brilliant, so go easy..
Thanks!
Damo
“Topmost” only makes sense in a windowed environment.
Full-screen games and movies usually switch the mode to full-screen exclusive mode. That means that single application has pretty much total control over video – it can change the resolution, be the only application displayed, etc.
A windowed application, even in “topmost”, isn’t going to be displayed when another application has full screen exclusive mode, because there’s no windowing concept available anymore.