include("../include.php"); writeHeader("Flat boardered controls", "Programming » Visual Basic 6 » Visual Basic 6 Code » Controls » ");?>
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _ ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Const GWL_STYLE = (-16) Private Const WS_THICKFRAME = &H40000 Private Const WS_BORDER = &H800000 Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_WINDOWEDGE = &H100& Private Const WS_EX_CLIENTEDGE = &H200& Private Const WS_EX_STATICEDGE = &H20000 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 Private Const SWP_NOOWNERZORDER = &H200 Private Const SWP_NOZORDER = &H4 Private Const SWP_FRAMECHANGED = &H20 Public Sub SetFlatBorder(hwnd As Long) SetWinStyle hwnd, GWL_STYLE, 0, WS_BORDER Or WS_THICKFRAME SetWinStyle hwnd, GWL_EXSTYLE, WS_EX_STATICEDGE, WS_EX_CLIENTEDGE Or _ WS_EX_WINDOWEDGE End Sub Private Sub SetWinStyle(ByVal hwnd As Long, ByVal lType As Long, _ ByVal lStyle As Long, ByVal lStyleNot As Long) Dim lS As Long Dim lhWnd As Long lhWnd = hwnd lS = GetWindowLong(lhWnd, lType) lS = lS And Not lStyleNot lS = lS Or lStyle SetWindowLong lhWnd, lType, lS SetWindowPos lhWnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or _ SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED End Sub