|
-
May 25th, 2000, 12:11 AM
#1
Thread Starter
Hyperactive Member
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
[Edited by WadeD on 05-25-2000 at 01:38 PM]
-
May 26th, 2000, 12:29 AM
#2
You could try to use the FlashWindow api call. It toggles the titlebar from active to non-active and back.
Public Declare Function FlashWindow Lib "user32" Alias "FlashWindow" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
The returnvalue is true (nonzero) if the window was active before the call.
Pass the windows hwnd, and True for bInvert to toggle the windows caption, or False to restore the original state.
-
May 26th, 2000, 03:03 AM
#3
Thread Starter
Hyperactive Member
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|