Move System Tray, Start Button etc along the Taskbar using a Timer.
Tested with Windows XP.
Note- little update (removing an unnecessary if condition and few comments have been added) has been made to the code.
Printable View
Move System Tray, Start Button etc along the Taskbar using a Timer.
Tested with Windows XP.
Note- little update (removing an unnecessary if condition and few comments have been added) has been made to the code.
had a little fun with this, thanks
David
Thanks for the Comment Davadvice. Comments are Really appriciated :)
Hehehe.. Had some fun here. Small code b.t.w. Never knew that it would be "that easy".
Thanks Radjesh :D
Wow this is really good, so simple.
Did you manage this by yourself?
fun, but it only works if your task bar sits horizontal(bottom or top of screen), if its on the side of the screen it doesn't look good.
Hai cameron2 & Billy Conner,
extreamly sorry for the late comment to your posts.coz i am sure i did not notify of your comments.
caeonen2,
yah yah, just undestanding the window & it's messages helped me a lot.Quote:
Wow this is really good, so simple.
Did you manage this by yourself?
there are plenty of articles on the net on Window Messages and Undestaning the Window architect.
BillCorner
Ooops. just noted that problem >:D<Quote:
fun, but it only works if your task bar sits horizontal(bottom or top of screen), if its on the side of the screen it doesn't look good.
Here is my small code i wrote not so long ago, to determine where is the taskbar just aligned. It also helps to determine the actual desktop area.
Basic but works as well.
Funny code :) Maybe you can extend it to detect how close the mouse pointer is, then you can move the object close to the pointer, to make it easy to click on it.... Or just run before it, to be hard to catch :-DCode:Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Sub Form_Load()
Dim Rt As RECT
Rt = GetDesktopRect
With Rt
Debug.Print .Left; .Top; .Right; .Bottom
End With
End
End Sub
Private Function GetDesktopRect(Optional ByRef GetTaskBarP As Long = -1) As RECT
Static tWnd As Long
Dim Rt As RECT
Dim sX As Long, sY As Long
sX = Screen.Width / Screen.TwipsPerPixelX
sY = Screen.Height / Screen.TwipsPerPixelY
If tWnd = 0 Then tWnd = FindWindow("Shell_TrayWnd", vbNullString)
GetWindowRect tWnd, Rt
With GetDesktopRect
.Left = 0
.Top = 0
.Right = sX
.Bottom = sY
End With
With Rt
If .Left < 1 And .Top > 1 Then
GetDesktopRect.Bottom = .Top
GetTaskBarP = 1
Exit Function
End If
If .Left < 1 And .Top < 1 And .Bottom > sY Then
GetDesktopRect.Left = .Right
GetTaskBarP = 2
Exit Function
End If
If .Left < 1 And .Top < 1 And .Right > sX Then
GetDesktopRect.Top = .Bottom
GetTaskBarP = 3
Exit Function
End If
If .Left > 0 Then
GetDesktopRect.Right = .Left
GetTaskBarP = 4
Exit Function
End If
End With
End Function
Thanks Davis for the code :)
Just got registered and was looking through the forum. I've been using AutoHotKey for doing small apps and this is something I was trying to do with that {the system tray part anyway}. I haven't taken a look at this yet, but I wanted to thank you in advance
Peace to you and yours,
Matthew "Dra'Gon" Stohler
Thank You TechnoDragon :wave: