Making a window stay onto

Posted on 2004-10-23
Last Modified: 2010-04-17

Here goes it:

I have a program that I use, I didn't create the program. Nortel Networks created the program. Unfortunately in this program there is no feature to make the
window stay on top at all times. Is there any way I can make this program stay ontop at all times? Either through the registery or what not?

Question by:heymanr
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    If you have access to a programming language such as C or VB, then you can get a handle to the window and make it topmost using API's.

    What tools are available to you?


    Author Comment

    I have VB6
    LVL 85

    Accepted Solution

    Here is one way to do it using the FindWindow() and SetWindowPos() API's.  Just replace "Calculator" with the exact caption of the window you want to stay on top.

    Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    Private Const HWND_TOPMOST = -1
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOMOVE = &H2

    Private Sub Command1_Click()
        Dim calcWnd As Long
        calcWnd = FindWindow(vbNullString, "Calculator")
        If calcWnd <> 0 Then
            SetWindowPos calcWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
            MsgBox "Window not found"
        End If
    End Sub

    Assisted Solution

    Or a more permanent solution is to use a resource editor such as this one  (there's plenty of others) to edit the resources in the appliction, and change parameters of dialogs menus etc.

    Of course since someone else wrote this software, you should check if the license prohibits reverse-engineering (which it probably does!)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now