 |

02-12-2002, 02:12 PM
|
|
|
How to make "Always On Top" function work with Multiple forms???
|
I can´t seem to get my app. to work like this (On Top) :
[Windows app]<-[Main_Form]<-[Pop_up_Form2]<-[Pop_up_Form3]
"Main form" should always be on top of other "windows appz", my "popups forms" should be on top over "windows appz" AND main_form and so on...
How do i make this work??
I would be very grateful for some help :-D
/Finnmaid 
|
|

02-12-2002, 02:16 PM
|
 |
Hell's Angel
Retired Moderator * Guru *
|
|
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
|
|
|
The sub forms need to be made TOPMOST aswell.
|
__________________
A wise one man once said "what you talking about dog breath"
|

02-12-2002, 02:17 PM
|
 |
Mostly Harmless?
Retired Moderator * Expert *
|
|
Join Date: Jun 2001
Location: Western Illinois, USA
Posts: 2,398
|
|
Are they modal forms? If they are then you can just do it like this in the code where you load the forms.
Code:
Private sub thisformontop()
thisform.show 1, callingform
End sub
substitute "thisform" and "callingform" for the actual form names in your app.
The 1 constant, btw = vbmodal
|
__________________
Don
"So long and thanks for all the fish.'" - Douglas Adams.
|

02-12-2002, 02:31 PM
|
|
|
Here goes again...
|
I´m a newbie in VB6. So i explain what i have tried...
Ive tried to solve the problem by using a API call and the activate in on form load, it works great with one form. But only for one..
Private Sub Form_Load()
lR = SetTopMostWindow(Form1.hwnd, True)
End Sub
[MODULE]
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
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|