Results 1 to 2 of 2

Thread: Maximize!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 1999
    Location
    Turner ME USA
    Posts
    18

    Post

    I've had some good responses in order to get my program to maximize after my timer runs, it's actually just using the Form1.Show command suits me OK. Problem is, I would like the window to float on top of everything else that might be running at the time the window pops=up.

    Does anyone have any suggestions to enable the window to do that/

    Thanks for your help!

    Jeff

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    I'm not sure but maybe this will help:
    In module
    Code:
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2
    Private Const SWP_NOMOVE = &H2
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOACTIVATE = &H10
    Private Const SWP_SHOWWINDOW = &H40
    Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, y, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
    Public Sub MakeNormal(Handle As Long)
    	'// Replaces the window in the ZOrder
    	SetWindowPos Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
    End Sub
    
    Public Sub MakeTopMost(Handle As Long)
    	'// Sets the window in the ZOrder
    	SetWindowPos Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
    End Sub
    In a form
    Code:
    '// To use the code just add two command buttons
    Private Sub cmdOnTop_Click()
    	MakeTopMost Me.hwnd
    End Sub
    
    Private Sub cmdNormal_Click()
    	MakeNormal Me.hwnd
    End Sub
    This code comes from VB-Square

    ------------------
    Visual Basic Programmer (at least I want to be one)
    ------------------
    PolComSoft
    You will hear a lot about it.



    [This message has been edited by QWERTY (edited 11-27-1999).]

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