Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Visual Basic for Applications

Post new topic   Reply to topic
Always have a window on top
View previous topic :: View next topic  
Author Message
batch
Newbie


Joined: 08 Jun 2005
Posts: 3

PostPosted: Jun 15th, 2005 02:11 PM    Post subject: Always have a window on top Reply with quote

Hey hey! I am wanting to make it so that my form is ALWAYS on top of any other window e.g. if you open a different window then the form automatically appears again appearantly there is an api call to do it that is 1 line. Also I thought if you could make it so that the window is ontop but not if you opened another window but u just make a while loop. Thank you very much.
Back to top
View user's profile Send private message Send e-mail
rbgCODE
Regular


Joined: 11 Nov 2004
Posts: 54
Location: Manchester CT

PostPosted: Jun 17th, 2005 12:17 PM    Post subject: Reply with quote

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

Public Sub FormOnTop(hWindow As Long, bTopMost As Boolean)
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
 wFlags = SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW Or SWP_NOACTIVATE
 Select Case bTopMost
  Case True:        Placement = HWND_TOPMOST
  Case False:       Placement = HWND_NOTOPMOST
 End Select
 SetWindowPos hWindow, Placement, 0, 0, 0, 0, wFlags
End Sub

_________________
'><>
'rBg
'><>
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Visual Basic for Applications All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic