Making a window stay onto

Posted on 2004-10-23
Medium Priority
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
  • 2
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12390176
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

ID: 12390184
I have VB6
LVL 86

Accepted Solution

Mike Tomlinson earned 500 total points
ID: 12390641
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

flubs earned 500 total points
ID: 12392729
Or a more permanent solution is to use a resource editor such as this one http://www.wilsonc.demon.co.uk/d6peresourceeditor.htm  (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!)

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Today, unlike web development, the mobile landscape is complex enough for a software engineer and Android is posing more challenging environment thanks to its fragmentation issues on hardware and software fronts.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

588 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