|
Написание слова прямо поверх всех окон |
|
|
Данный пример покажет как получить handle Рабочего Стола с тем, чтобы вы могли рисовать прямо на Рабочем Столе. Данный пример всего лишь напишет слово "vbAccelerator" прямо поверх всех окон. Private Declare Function CreateDCAsNull Lib "gdi32" Alias
"CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any,
lpInitData As Any) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA"
(ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal
wFormat As Long) As Long
Private Declare Function GetTextColor Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal
crColor As Long) As Long
Public Sub TestDesktopDC()
Dim hdc As Long
Dim tR As RECT
Dim lCol As Long
hdc = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)
tR.Left = 60
tR.Top = 0
tR.Right = 640
tR.Bottom = 32
lCol = GetTextColor(hdc)
SetTextColor hdc, &HFF&
DrawText hdc, "vbAccelerator", Len("vbAccelerator"), tR, 0
SetTextColor hdc, lCol
DeleteDC hdc
End Sub
Private Sub Command1_Click()
TestDesktopDC
End Sub
|
|
|
|
|
|
|