by bj?rn linse (1 Submission)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 1st January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Show a clock on the desktop
API Declarations
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 SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
'set borderstyle to 0-none
'add a timer
'set interval to 1000
Dim hdesktop As Long
hdesktop = FindWindowEx(0&, 0&, "progman", vbNullString)
SetParent hWnd, hdesktop
Width = TextWidth("99:99:99:")
Height = TextHeight("99:99:99:")
Left = Screen.Width - Me.Width - 100
Top = 100
BackColor = vbDesktop
End Sub
Private Sub Timer1_Timer()
Cls: Print Time$
End Sub