Results 1 to 6 of 6

Thread: EZ Always on top!!!!????

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Question EZ Always on top!!!!????

    Ok, I'm not wanting to use a module or anything to do this. I have a form that the user selects options on. I want to keep this window on top until it is closed. What's the EASIEST way to acomplish this?

  2. #2
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    Depends on what you want. You can use API's to put the window on top while still being able to use other forms - like a Find window, for example.

    For your purposes, just use show with vbmodal

    Form1.Show vbModal

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    I can't.......

    I'm executing code on the main form while the other windows are visible, and using vbmodal will kill that code. I just want to keep the window on top of Everything until it is closed, but still be able to use other forms.

  4. #4
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    VB Code:
    1. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewLong As Long) As Long
    2.  
    3. Private Const GWW_HWNDPARENT = -8
    4.  
    5. Public Function AlwaysOnTop(frm As Form, frmParent As Form) As Long
    6.  
    7. On Error Resume Next
    8.  
    9. AlwaysOnTop = SetWindowLong(frm.hwnd, GWW_HWNDPARENT, frmParent.hwnd)
    10.  
    11. End Function

  5. #5
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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) As Long

    Private Sub TopMost(ByVal frm As Form)
        SetWindowPos frm.hwnd, -1, &H3
    End Sub


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    What syntax?

    what syntax would I use on the form load event to make the form always on top?

    TopMost (frmOptions)

    I'm sure I screwed this up really bad so please help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width