Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form focus
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00685856
Message ID:
00685872
Views:
31
>I have a small VB app - it's not an MDI app - it has four individual screens.
>
>When I open screen 2 from screen 1 - screen 2 opens 'behind' screen 1. What do I need to do to make screen 2 open "on top" of screen 1?


This is copied from another thread. You will find the required code in there.

Take a look to help file on following function:
SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_TOPMOST)

This will make it "Always On Top", but do not activate.

HTH.

>Below is a couple of fucntions I got from Bnowledge Base that I use to make a Window always-on-top. Can someone tell me if I can do this without making the Window have the focus?
>
>Thanks.
>
>
> Option Explicit
> Public Const SWP_NOMOVE = 2
> Public Const SWP_NOSIZE = 1
> Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
> Public Const HWND_TOPMOST = -1
> Public Const HWND_NOTOPMOST = -2
>
> 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 Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) _
> As Long
>
> If Topmost = True Then 'Make the window topmost
> SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _
> 0, FLAGS)
> Else
> SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _
> 0, 0,FLAGS)
> SetTopMostWindow = False
> End If
> End Function
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform