ProgressBar en trayBar 1º parte
Dim CurrentPercent As Integer
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private 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
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
MsgBox ("Look at you clock at System Tray")
Dim hWnd As Long, rctemp As RECT
hWnd = FindWindow("Shell_TrayWnd", vbNullString)
hWnd = FindWindowEx(hWnd, 0, "TrayNotifyWnd", vbNullString)
'hWnd = FindWindowEx(hWnd, 0, "TrayClockWClass", vbNullString) 'uncomment
'this string and look progressbar only at clock
GetWindowRect hWnd, rctemp
With Me
.Top = 0
.Left = 0
.Height = Me.Height * (rctemp.Bottom - rctemp.Top) / Me.ScaleHeight
.Width = Me.Width * (rctemp.Right - rctemp.Left) / Me.ScaleWidth
End With
Timer.Enabled = True
SetParent Me.hWnd, hWnd
Picture1.Height = Me.ScaleHeight
Picture1.Width = Me.ScaleWidth
End Sub