|
-
Oct 28th, 2000, 09:05 PM
#1
Thread Starter
Addicted Member
I've heard it called "floating" a window. So, you know my question. How do you do it?
Is it tired in here or is it just me?
Ryan Williams
-Using Vb6-
-
Oct 28th, 2000, 09:09 PM
#2
Frenzied Member
Hey mate! you're in luck I've been using it lately (read: yesterday ), here it comes!
Code:
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub 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)
'To set on top:
SetWindowPos frmMain.hWnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
'To undo this:
SetWindowPos frmMain.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
Gottagosleeping now, see ya!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 28th, 2000, 09:50 PM
#3
If you want to set another window as the top most one, all you need is the handle (hwnd) of another program to make that program stay on top of all others. You can use the FindWindow api function to do it.
Code:
Private Declare Function FindWindow Lib "user32.dll" _
Alias "FindWindowA" (ByVal lpClassName As Any, ByVal _
lpWindowName As Any) As Long
You can use it like this:
Code:
Private Sub Command1_Click()
'Finds Calculator
hWin = FindWindow(vbNullString, "Calculator")
If hWin <> 0 Then 'If Calculator found...
'Set the Calculator as topmost window
SetWindowPos hWin, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End If
End Sub
Not sure if you wanted this, but you said a window.
-
Oct 28th, 2000, 09:53 PM
#4
Thread Starter
Addicted Member
Thanks mate! G'd-reply. You really hit the kangaroo on the head with that one! You're sharp as a boomarang! You deserve a trip to Out Back Steak House where we can kick back and have a couple of Fosters!
hehe
Hey...I kid because I love (in a programmer sort of way)!
Is it tired in here or is it just me?
Ryan Williams
-Using Vb6-
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
|