Results 1 to 3 of 3

Thread: Form on Top

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I'm trying to make an intro form like in the progs of the MS Office Suite. But the intro form is sent to the back.
    How do i get it to show up on top instead??

  2. #2
    Guest
    Code:
    Form.Show vbModal
    or you can do this

    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
    
    Private Sub Form_Load()
        Call SetWindowPos(Me.hWnd, (-1), 0,0,0,0, 3)
    End Sub

    [Edited by denniswrenn on 09-01-2000 at 10:20 PM]

  3. #3
    Guest
    Use the SetWindowPos API:

    Put this in a module:
    Code:
    Public 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
    
    Public Const SWP_NOMOVE = &H2
    Public Const SWP_NOSIZE = &H1
    
    Public Const HWND_TOPMOST = -1
    
    Public Sub MakeAlwaysOnTop(ByVal hWindow As Long)
        SetWindowPos hWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
    End Sub
    And this in the Form_Load() event:
    Code:
    Private Sub Form_Load()
        MakeAlwaysOnTop Me.hWnd
    End Sub
    Hope this helps.

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