Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

List Stealer

Browsing DrawWndBorderMod.bas (2.68 KB)

Attribute VB_Name = "DrawWndBorderMod"
Option Explicit

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetClipRgn Lib "gdi32" (ByVal hDC As Long, ByVal hRgn As Long) As Long
Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function Rectangle Lib "gdi32" (ByVal hDC As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hDC As Long, ByVal hRgn As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function SetROP2 Lib "gdi32" (ByVal hDC As Long, ByVal nDrawMode As Long) As Long
Private Const DRAWSTYLE_SOLID = 0
Private Const DRAWSTYLE_INVERT = 6
Private Const NULL_BRUSH = 5

Private Old_hWnd As Long


Public Sub DrawWindowBorder(hWnd As Long)
Dim hDC As Long
Dim Pen As Long
Dim Brush As Long
Dim OldPen As Long
Dim OldBrush As Long
Dim OldROP As Long
Dim Region As Long
Dim OldRegion As Long
Dim FullWnd As RECT
Dim Draw As RECT
    If Old_hWnd <> hWnd And Old_hWnd <> 0 Then DrawWindowBorder Old_hWnd
    Old_hWnd = hWnd
    GetWindowRect hWnd, FullWnd
    Region = CreateRectRgn(0&, 0&, FullWnd.Right - FullWnd.Left, FullWnd.Bottom - FullWnd.Top)
    hDC = GetWindowDC(hWnd)
    GetClipRgn hDC, OldRegion
    SelectObject hDC, Region
    Pen = CreatePen(DRAWSTYLE_SOLID, 6, 0)
    OldPen = SelectObject(hDC, Pen)
    Brush = GetStockObject(NULL_BRUSH)
    OldBrush = SelectObject(hDC, Brush)
    OldROP = SetROP2(hDC, DRAWSTYLE_INVERT)
    With Draw
        .Left = 0
        .Top = 0
        .Bottom = FullWnd.Bottom - FullWnd.Top
        .Right = FullWnd.Right - FullWnd.Left
        Rectangle hDC, .Left, .Top, .Right, .Bottom
    End With
    SelectObject hDC, OldRegion
    SetROP2 hDC, OldROP
    SelectObject hDC, OldBrush
    SelectObject hDC, OldPen
    DeleteObject Brush
    DeleteObject Pen
    DeleteObject Region
    ReleaseDC hWnd, hDC
End Sub


Download DrawWndBorderMod.bas

Back to file list


Back to project page