|
-
Aug 3rd, 2000, 03:57 AM
#1
Thread Starter
Hyperactive Member
How can I make sticky windows just like winamp. (which stick to the other windows of winamp)? and position form2 exactly under form1.
-
Aug 3rd, 2000, 05:13 AM
#2
Fanatic Member
Something like:
Code:
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Timer1_Timer()
Dim tRect As RECT
If Me.Left < 700 Then Me.Left = 0
If Me.Left > 7500 Then Me.Left = Screen.Width - Width
If Me.Top < 700 Then Me.Top = 0
If Me.Top > 7500 Then
Call GetWindowRect(FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString), tRect)
Top = ScaleY(tRect.Top, vbPixels, vbTwips) - Height
Exit Sub
End If
End Sub
*Gotten off PlanetSourceCode.com*
Hope that helps,
D!m
-
Aug 3rd, 2000, 01:47 PM
#3
Thread Starter
Hyperactive Member
thanx for the above code, its perfect.
there is another question
i have two forms, form1 and form2,
form1 is movable and form2 is not.
i want form2 to move when form1 moves and place it exactly under form1. how do i do that?
-
Aug 3rd, 2000, 02:06 PM
#4
Wow, I'm glad you like that code wasiq. Anyway, to stick your form2 under form1:
Code:
'Timer interval set at 1
Private Sub Form_Load()
Form2.Show
End Sub
Private Sub Timer1_Timer()
Form2.Left = Form1.Left
Form2.Top = Form1.Top + 2700
End Sub
-
Aug 4th, 2000, 12:43 AM
#5
Thread Starter
Hyperactive Member
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
|