|
-
Jun 20th, 2000, 08:19 AM
#1
Thread Starter
Frenzied Member
Ok, I searched VBWORLD, and I know how to make one form stay on top. Now if my program has more than one form, how do I make both of the forms be on top(not at the same time)
NXSupport - Your one-stop source for computer help
-
Jun 20th, 2000, 08:30 AM
#2
Addicted Member
what do you mean by not at the same time???
and if you want to make both of them stay on top, just do the same function again but change the name of the form, thats it
-
Jun 20th, 2000, 08:34 AM
#3
Thread Starter
Frenzied Member
ok, I guess I didn't explain it clearly, I need one form to be visible at a time, and the form that is visible to be on top of all the other programs. Only problem is that in the code that I got, only had room for one name, if I write the code 2 times, an error message comes up
NXSupport - Your one-stop source for computer help
-
Jun 20th, 2000, 08:46 AM
#4
transcendental analytic
What code are you using? I think you could set several window on top but they will block each other as they all are on the same level. use setforegroundwindow api to put your window topmost
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 20th, 2000, 09:00 AM
#5
Thread Starter
Frenzied Member
I'm using the code that I found in a
Visual Basic Programmer's Journal
'paste this into a module:
Private Declare Function SetWindowPos Lib _
"user32" (ByVal hWnd As Long, ByVal _
hWndIsertAfter As Long, ByVal X As Long, _
ByVal Y As Long, ByVal cx As Long, ByVal cy _
As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOActivate = &H10
Public Enum WindowPos
vbtopmost = -1&
vbnottopmost = -2&
End Enum
Public Sub SetFormPosition(hWnd As Integer, _
Position As WindowPos)
Const wFlags As Long = SWP_NOMOVE Or _
SWP_NOSIZE Or SWP_SHOWWINDOW Or SWP_NOActivate
If Position = vbtopmost Or Position = vbnottopmost Then
SetWindowPos hWnd, Position, 0, 0, 0, 0, wFlags
End If
End Sub
'Paste this into the form load procedure for it to stay on top
SetFormPosition Me.hWnd, vbTopMost
'paste this into a command for the form not to be on top
SetFormPosition Me.hWnd, vbNotTopMost
NXSupport - Your one-stop source for computer help
-
Jun 21st, 2000, 12:14 AM
#6
transcendental analytic
I'm surprised they put hwnd as integer instead of long. Other than that, i would say it should work fine with multiple windows, just put their handle in the hwnd argument.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 21st, 2000, 12:16 AM
#7
Thread Starter
Frenzied Member
Can you please tell me what code to write? I'm not very smart
NXSupport - Your one-stop source for computer help
-
Jun 21st, 2000, 12:20 AM
#8
transcendental analytic
Shoudn't be that hard, just pass them like this:
Code:
SetFormPosition form1.hwnd, vbtopmost
SetFormPosition form2.hwnd, vbtopmost
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 21st, 2000, 12:24 AM
#9
Thread Starter
Frenzied Member
THANKS
THANKS ALOTTTTTTT that helped me ALOT!!!
NXSupport - Your one-stop source for computer help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|