About "Always on Top" windows

Hi all,
My application needs an always on top window and I used a dll written
by Mitch Goldstein. It works perfectly on jvm 1.3.1, but when I try it
on jvm1.4.1 which is more popular today than 1.3.1, it just doesn't
work, without any exceptions.
Can anybody give some hints? Thanks a lot.
The "Always on top" package written by Mitch Goldstein with examples
can be downloaded from the following address:
http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/toplevelcontainers/jframe/jframealwaysontop.html

For JRE 1.3 and above, the following code addresses the issue of having two windows with the same title. The function takes a Frame as a parameter, gets the HWND using the AWT Native Interface, and then calls SetWindowPos. Agreed, this code is far more complicated than smg123's solution, but if there's a chance of two windows having the same title, it's probably better to use this:JNIEXPORT void JNICALL Java_JSystem_setWindowAlwaysOnTop__Ljava_awt_Frame_2Z (JNIEnv *env, jclass cls, jobject frame, jboolean flag)
     typedef jboolean (JNICALL* PJAWT_GetAWT) (JNIEnv*, JAWT*); // Function pointer
     JAWT jawt;
     JAWT_DrawingSurface* jds;
     JAWT_DrawingSurfaceInfo* jdsi;
     JAWT_Win32DrawingSurfaceInfo* jdsi_win;
     HANDLE hAWT;
     HWND hwnd;
     jboolean result;
     PJAWT_GetAWT JAWT_GetAWT;
     LPTSTR buf;
     jclass sys;
     jmethodID home;
     jstring ret;
        // This section of code is needed in order to find jawt.dll
     sys = (*env)->FindClass (env, "java/lang/System");
     home = (*env)->GetStaticMethodID (env, sys, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;");
     ret = (jstring)(*env)->CallStaticObjectMethod(env, sys, home, (*env)->NewStringUTF (env, "java.home"));
     buf = (LPTSTR)(*env)->GetStringUTFChars (env, ret, NULL);
     strcat (buf, "\\bin\\jawt.dll");
     hAWT = LoadLibrary ((LPCTSTR)buf);
     if (!hAWT) return;
     JAWT_GetAWT = (PJAWT_GetAWT)GetProcAddress(hAWT, "_JAWT_GetAWT@8");
     jawt.version = JAWT_VERSION_1_3;
     result = JAWT_GetAWT (env, &jawt);
     jds = jawt.GetDrawingSurface (env, frame);
     jds->Lock(jds);
     jdsi = jds->GetDrawingSurfaceInfo (jds);
     jdsi_win = (JAWT_Win32DrawingSurfaceInfo *)jdsi->platformInfo;
     hwnd = jdsi_win->hwnd;
     SetWindowPos (hwnd, flag ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     jds->FreeDrawingSurfaceInfo (jdsi);
     jds->Unlock(jds);
     jawt.FreeDrawingSurface (jds);
     (*env)->ReleaseStringUTFChars (env, ret, buf);
}Note that you must include jawt_md.h as that's where all the types such as JAWT are declared. You can link statically with jawt.lib, but as it is dangerous to assume the JRE version on the user's system, it's probably a better idea to link dynamically and handle any errors that occur.
Hope that helps.
Cheers

Similar Messages

  • Always-on-top window property

    Hi guys,
    Starting to like fx beta a lot.
    Is there any way to initialize stage with always-on-top window property? Any plans to support it?
    Thanks,
    Alexander.

    Yes It would be grate to support this,.

  • Always on top windows

    How can I make "Always on top" window in Java?
    Thanks

    Hi, i a using jdk1.3 on mandrake linux, how to make Jwindow reside on top of all the other windows, i've tried using the listeners, problem is once the focus moves to any of the child component of the window, the focus listener for Jwindow will not work, even requestFocus on the jwindow doesn't get the focus on the window, i can't take JFrame, (don't want title bar), if any body can help with JNI code on linux to make the Jwindow always on top.
    shivajee

  • Problem creating an "always on top" window

    Hi to all,
    I'm developing an application and I want to create an "always ot top" window (for win32).
    I used madtown54's c++ code (http://forum.java.sun.com/thread.jsp?forum=57&thread=348024&message=1443221#1443221), but at runtime I receive this error:
    java.lang.UnsatisfiedLinkError: getNativeWindowHandle
    at com.tilab.newtel.popupclient.DisplayMessage.getNativeWindowHandle(Native Method)
    I'va also tried vdbjoris' code(http://www.esus.com/docs/GetQuestionPage.jsp?uid=102 ), but with the same result...
    Any suggestion?

    Thank you for your reply!
    Yes, I have. I receive an error when I try to call a native method, not when loading the .dll library.
    Any other suggestion?
    Luca

  • How to Create Always on Top Window OR Frame

    hi i m hasan, i m using windows 98, and i want to know that how to create a Window OR Frame, which should remain always on top. In windows 98 by pressing windows+D key hides all windows and dailog boxes. But I want it should remain always on top even if some one press windows+D key it should not be minimized.

    Try this code. It should be work on all windows which are inherited from java.awt.Window
    * Call this from class consructor
    public void initialize() {
    TopThread top = new TopThread();
    top.start();
    * Keep JWindow on top (inner class)
    class TopThread extends Thread {
    public void run() {
    while(true) {
    toFront();
    * Let 10 milliseconds for other code to execute
    try {
    Thread.sleep(10);
    catch(Exception e) {
    // Nothing to do

  • Always on top window (not modal)

    Hi, everyone:
    Is there a way of making a window to be displayed always on top? I don't want it to be a modal window. I want the user to be able to flip to another (background) form, but still being able to fully see my current form on top.
    Thanks a lot.
    Regards,
    Eugene.

    Yes this is possible - if you are using Forms client server on windows you can find the code on Metalink (metalink.oracle.com) Note:68822.1

  • Can I make the TestStand Properties dialog an 'always on top' window?

    I am having window Z order problems, such that calling PropertyObject.DisplayPropertiesDialog() sometimes sends the window behind the my application window. This causes people to think that the application has crashed (it's only waiting for them to dismiss the properties dialog), and often results in the fatal three finger salute.
    This problem cannot be solved by setting Engine.AppMainHwnd, or using the PropDlgOption_ModalToAppMainWind option - it's a long story. Is there a way to set the Z-order priority of TestStand dialogs? If I could set the dialog to 'always on top', all my problems would be solved.
    Thanks,
    Aaron Stibich
    Senior Engineer
    Innovative Technologies Inc.

    Hi Aaron,
    Unfortunately there is no way in TestStand to set the Z order property. You may be able to use Windows API calls though to accomplish the same goal. I will however put in a product suggestion for you so that this request may be looked at.
    Thanks,
    Caroline
    National Instruments
    Thanks,
    Caroline Tipton
    Data Management Product Manager
    National Instruments

  • Always on-top window help!

    I am trying to get a window to be on top of a game application called "halo". The problem is that the game always want to be on top and I have tried to use a program called AutoIt, but I have to keep on setting the window to be ontop which cause a flickering effect. I would also like to make the window invisable and some buttons/images on it transparent. How would I do this?

    try this link: http://forum.java.sun.com/thread.jsp?forum=57&thread=156009&tstart=975&trange=15

  • When using facebook and youtube, switching tabs causes youtube content to popup into a persistent always on top window

    I have disbled all add-ons. This problem has only started to occur in the last week. I can provide a screen cap if necessary.

    I had saved one copy as an .asp but then resaved it to .xhtml 
    I'm assuming this is a static web site.  Rename (F2) all your pages with .html or .htm extension. 
    .xhtml is not a valid extension.
    Nancy O.

  • "Always on Top" of jdk 1.5 is not working when...

    I created a sample application that has Frame/Window and displays some text. Then i needed to make the window always visible on top of any other application or windows. But then when i opened applications like Battle Realms, Counter Strike, or any other games, the window is blocked by the previously run application.
    Can you help me on how can i provide solution with this?
    Thanks in advance.

    This might help you!!!
    About setAlwaysOnTop()
    Changes the always-on-top window state. An always-on-top window is a window that stays above all other windows except maybe other always-on-top windows. If there are several always-on-top windows the order in which they stay relative to each other is not specified and is platform dependent.
    If some other window already is always-on-top then the relative order between these windows is unspecified (depends on platform). No window can be brought to be over always-on-top window except maybe another always-on-top window.
    All owned windows of an always-on-top window automatically become always-on-top windows. If a window ceases to be always-on-top its owned windows cease to be always-on-top.
    When an always-on-top window is sent toBack its always-on-top state is set to false.
    This method makes the window always-on-top if alwaysOnTop is true. If the window is visible, this includes bringing window toFront, then "sticking" it to the top-most position. If the window is not visible it does nothing other than setting the always-on-top property. If later the window is shown, it will be always-on-top. If the Window is already always-on-top, this call does nothing.
    If alwaysOnTop is false this method changes the state from always-on-top to normal. The window remains top-most but its z-order can be changed in the normal way as for any other window. Does nothing if this Window is not always-on-top. Has no effect on relative z-order of windows if there are no other always-on-top windows.

  • Always on Top Frame

    HI, I have search a lot about Always on Top Frame, but couldn't found the solution of my problem.
    My application has a PropertyWindow, the problem is, I want my PropertyWindow always on Top. Please suggest me which container should I use, because If I use JFrame as a PropertyWindow, another frame is created and windows toolbar have two windows.
    If I use JPanel, I dont found the functionalities like WindowClosing, Settitle etc etc.
    Please help me to get rid of this annoying problem. I want exactly something like JBuilder or Photoshop functionality where property windows are always on top and also seperate with the application.

    But I got this error while using 1.5
    "ConnectionPool.java": cannot access java.lang.Object,bad class file: C:\Program Files\Java\j2sdk1.5.0\jre\lib\rt.jar\java\lang\Object.class,class file has wrong version 49.0, should be 48.0,Please remove or make sure it appears in the correct subdirectory of the classpath. at line 13, column 11
    "DBIdentifier.java": cannot access java.lang.String,bad class file: C:\Program Files\Java\j2sdk1.5.0\jre\lib\rt.jar\java\lang\String.class,class file has wrong version 49.0, should be 48.0,Please remove or make sure it appears in the correct subdirectory of the classpath. at line 12, column 11
    Everything works fine in 1.4
    Please Help
    Thanks

  • XWindows JNI Always on Top

    Could anyone direct me in a possible way to implement always-on-top window on Linux with JNI for X-windows. I'm attempting to write Always-On-Top helper classes for Windows, OS X, and Linux.
    here's a link I found about it:
    http://groups.yahoo.com/group/java-linux/message/14777
    I have no experience programming X-windows, but am willing to put some effort into it.
    Also, I'm having a hard time loading libraries on Windows and OS X:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=429203
    http://forum.java.sun.com/thread.jsp?forum=31&thread=428106

    I'm gonna go with a fairly easy, but not exactly correct approach.
    setFocusableWindowState(false);
    and have a thread call .toFront() every 1/3 second
    This only appears to work in linux, not windows(maybe OS X, haven't tried...)
    --Zephryl                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • HTA Always on Top

    Hi all,
    I've got a lovely HTA that is intended to be displayed on all our users screens at Windows startup, as defined by a GPO.  While everything is working fine, I'd really like to have it as an "always on top" window or at least grab focus/flash whenever somebody clicks away.
    Every forum thread I've found via Google says this is not possible, but other people have found 'hacks' to get this to work.  Various people mention either modal/modeless dialogues or using an onblur function.  Unfortunately, as a self taught 'coder', my VBS/HTA powers are fairly weak and I don't really know how to put this into practice.
    Would anybody be able to give me some guidance on how I could possibly launch the HTA and retain focus or keep it above other windows somehow?
    Cheers
    Andy

    You need a Third-party application
    http://www.nirsoft.net/utils/nircmd.html 32 or 64 bit version
    put nircmdc.exe in your path or in the folder with hta file,
    now use this sample .hta
    <!========================================================================
    <!
    <! NAME: RusiaToday.hta
    <!
    <! REVISION:
    <!
    <! AUTHOR: Emprear / gc.gianello[dot]gmail.com
    <!
    <! DATE  : 15/02/2013 09:03:38
    <!
    <! COMMENT:
    <!     Rusia Today en Español
    <!     Canal Internacional de Noticias
    <!
    <!======================================================================-->
    <!
    <html>
    <head>
    <title>RusiaToday</title>
    <script type="text/javascript">
    window.resizeTo(470,300);
    var intHorizontal = screen.width;
    var intVertical =screen.height;
    var left_pos = (intHorizontal - 470) / 2;
    var top_pos = (intVertical - 300) / 2;
    window.moveTo(left_pos,top_pos);
    </script>
    <HTA:APPLICATION
    ID="RusiaToday"
    APPLICATIONNAME="RusiaToday"
    BORDER="Dialog"
    BORDERSTYLE="Normal"
    CAPTION="yes"
    CONTEXTMENU="no"
    INNERBORDER="no"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="no"
    ICON = "http://actualidad.rt.com/favicon.ico"
    SCROLL="no"
    SELECTION="no"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    SYSMENU="yes"
    WINDOWSTATE="Normal"
    >
    <script type="text/javascript">
    function ontop(){
    if ((document.getElementById('wtop').innerHTML) == 'notop') {
    document.getElementById('wtop').innerHTML = 'top';
    new ActiveXObject("WScript.Shell").Run('%comspec% /C nircmdc win settopmost title RusiaToday 0',0,true);
    }else{
    document.getElementById('wtop').innerHTML = 'notop';
    new ActiveXObject("WScript.Shell").Run('%comspec% /C nircmdc win settopmost title RusiaToday 1',0,true);
    </script>
    <style type="text/css">
    html, body{
    padding: 0;
    border: none;
    margin: 0;
    overflow: hidden;
    object#rto{
    margin: 0;
    border: none: padding: 0;
    left: 0;
    top: 0
    z-index: 1;
    button#wtop{
    top: 1%;
    right: 1%;
    z-index: 999;
    width:38px;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    /*]]>*/
    </style>
    </head>
    <body style="background:#1E1D11">
    <object type="application/x-shockwave-flash" data="http://actualidad.rt.com/static/jwplayer/player.swf" id="rto" height='274' width='470'>
    <param name="movie" value="http://actualidad.rt.com/static/jwplayer/player.swf" />
    <param name="loop" value="false" />
    <param name="menu" value="false" />
    <param name="play" value="true" />
    <param name="wmode" value="transparent" />
    <param name='allowfullscreen' value='true'>
    <param name='allowscriptaccess' value='always'>
    <param name="flashvars" value="&autostart=true&backcolor=0x000000&bandwidth=1016&controlbar=over&file=RT_Spanish_2&frontcolor=0xffffff&image=http%3A%2F%2Factualidad.rt.com%2Fstatic%2Fvideo-player-bg.png&lightcolor=0xffffff&mute=false&plugins=viral-2d&screencolor=0x404040&skin=http%3A%2F%2Factualidad.rt.com%2Fstatic%2Fjwplayer%2Fplayer_skin.zip&streamer=rtmp%3A%2F%2Frt.fms.visionip.tv%2Flive%3Fautostart%3Dtrue&viral.onpause=false"
    />
    <param name="bgcolor" value="#1E1D11" />
    </object>
    <button onclick="ontop();" id="wtop">top</button>
    </body>
    </html>
    Look at the ontop() function and how alternate top and notop status using nircmdc command line utilitiy
    Thats all
    Regards

  • JWindow - always on top

    I've got a JWindow which appears always on top - not just of other Java windows but of any window in the window manager, but I'd prefer it to be always underneath or at least behave normally. All I seem to get from Googles is cases where people are trying to get this behaviour but can't because this kind of thing is supposed to be platform specific and out of Java's control?!
    This seems to happen in Gnome 2.8 and Openbox on Linux so I'm presuming it's not specific to a single WM. Any (constructive!) suggestions appreciated :)

    Copied from the javadocs:
    "Note: some platforms might not support always-on-top windows. There is no public API to detect if the platform supports always-on-top at runtime."

  • Dragging Document Windows - (Always On Top)?

    PS CS4 - latest
    A few times, I've dragged a document window over(on top of) a set of panels (layers,channels, etc). Once I let go of the mouse, the title bar of that window (the draggable bar) is placed behind the panels (I'm in standard screen mode). Most of the time this isn't an issue, and probably because I've never dragged a small enough document window over a panel set for this to be an issue worth asking about (all times before, the document window was wide enough to extend out behind the panel(s), so I was still able to click on the title bar. So, after moving this small window and letting go of the mouse, the title bar is completely hidden behind the panel. I know I can move the panels around and/or minimize the panels, but I'm wondering if there is a setting where you can have your document windows (always on top) of other panels?

    If you loose a window behind your panels just hit the tab key which hides all tool bars and panels, drag out your window and hit tab key to make your tools/panels visible again. Panels will always be on top of windows.

Maybe you are looking for

  • How can I clear the data from my iphone without powering it on?

    So, in an attempt to avoid a $50 charge at the apple store, I decided to replace my screen myself. I've done this plenty of times before without any incident, but this time, some how the battery terminal on the logic board came off with the battery h

  • Deploying ADF 11.1.2.3 to WLS 11.1.1.6

    I see in the release notes that two patches are required to the ADF Runtime to bring it to 11.1.2.3 when deploying to WLS 11.1.1.6: http://www.oracle.com/technetwork/developer-tools/jdev/11gr2update3-1851251.html#11.1.2.3.0ShermanUpdate3-ReleaseNotes

  • How to change date formate mm/dd/yyyy to dd/mm/yyyy

    Hi, In OBPM the date picker will come by default like mm/dd/yyyy. But my requiremet is i want to change to the formate dd/mm/yyyy. pls help me if any one knows this. Regards Jaya

  • Importing song files between computers

    Hi. I've been trying to help my wife import song files from her desktop PC iTunes library to her laptop PC iTunes library, without much success (I'm a Mac guy). Her iTunes libraries can "see" each other, but when you try to access them, a message app

  • Visio 2013 64-bit Trial

    Hello,  I have been working on this on and off again for the past few days. Still have not been able to crack the nut.  I downloaded the Visio 2013 64-bit trail (VisioProfessional_x64_en-us.img - it's 444MB) from Technet. At first I had issues gettin