Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How to make "Always On Top" function work with Multiple forms???


Reply
 
Thread Tools Display Modes
  #1  
Old 02-12-2002, 02:12 PM
Finnmaid
Guest
 
Posts: n/a
Default 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
Reply With Quote
  #2  
Old 02-12-2002, 02:16 PM
Banjo's Avatar
Banjo Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
 
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394
Default

The sub forms need to be made TOPMOST aswell.
__________________
A wise one man once said "what you talking about dog breath"
Reply With Quote
  #3  
Old 02-12-2002, 02:17 PM
dcl3500's Avatar
dcl3500 dcl3500 is offline
Mostly Harmless?

Retired Moderator
* Expert *
 
Join Date: Jun 2001
Location: Western Illinois, USA
Posts: 2,398
Default

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.
Reply With Quote
  #4  
Old 02-12-2002, 02:31 PM
Finnmaid
Guest
 
Posts: n/a
Default 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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->