Hi, how can I redraw my window's title bar? I have a foreign window tied to my navigational window. The foreign window doesn't have a title bar -- so when it has focus, I want to make my window appear to have focus. I'm using subclassing and can detect when the user is in this foreign window, but what I'm using to redraw my window's title bar blue isn't working:Code:Option Explicit Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long Private Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Private Const COLOR_ACTIVEBORDER = 10 Private Const WM_NCACTIVATE = &H86 If msg = WM_NCACTIVATE Then 'Foreign Window Activation/Deactivation If wp = 1 Then 'Has focus 'Get Device Context of My Window Including Non-client Area - This Works lhDC = GetWindowDC(Form1.hwnd) 'Set Background Color of Title Bar - This Doesn't Seem to Change Anything Call SetBkColor(lhDC, GetSysColor(COLOR_ACTIVEBORDER)) 'Release DC to My Window Call ReleaseDC(Form1.hwnd, lhDC) End If End If




Reply With Quote