Results 1 to 4 of 4

Thread: always on top

  1. #1

    Thread Starter
    Addicted Member aturner's Avatar
    Join Date
    Nov 2000
    Posts
    179

    Cool

    you probably get this all the time but ...

    How do you make your own start bar.

    Its alway on top, no matter what you load, how do you do it?
    Due to the energy crisis, the light at the end of the tunnel has been turned off.
    Sorry for any inconvenience this may cause

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    60

    Talking

    Use the setwindowpos API call,

    Module Code:
    Public Declare Function SetWindowPos Lib "user32.dll" (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

    Form Code:
    ret = setwindowpos(me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE OR SWP_NOSIZE)


    Hope this helps
    Grant French
    -----------------------------------------------
    E-Mail: [email protected]
    ICQ: 33122184

  3. #3
    Guest
    gfrench, don't forget to include everything. (Constants)

    Code:
    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
    
    Const SWP_NOMOVE = 2 
    Const SWP_NOSIZE = 1 
    Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE 
    Const HWND_TOPMOST = -1 
    Const HWND_NOTOPMOST = -2
    
    Private Sub Form_Load()
    SetWindowPos Me.hWnd, HWND_TOPMOST, _
    0, 0, 0, 0, FLAGS
    End Sub

  4. #4
    Guest
    You don't need constants if they're short enough.
    Code:
    Private Declare Function 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) As Long
    
    Private Sub Form_Load()
        SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
    End Sub

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