
Option Explicit
Private Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function FrameRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub Main()
Dim hWnd As Long, hDC As Long, hBrush As Long, rc As RECT
hWnd = GetDesktopWindow
hDC = GetWindowDC(hWnd)
SetRect rc, 100, 100, 500, 500
hBrush = CreateSolidBrush(vbRed)
FillRect hDC, rc, hBrush
DeleteObject hBrush
hBrush = CreateSolidBrush(vbBlack)
FrameRect hDC, rc, hBrush
DeleteObject hBrush
ReleaseDC hWnd, hDC
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 20