We help IT Professionals succeed at work.

change color and font weight of text in taskbar button

Hi,
I am wondering if there is anyway to chnage the color and font weight of the taskbar app button.
I am currenly using setwindowtext to set the title bar at run time and therefore the taskbar bvutton.
If you know of any techniques please let me know. even if they are supremely difficult.
thankyou
Comment
Watch Question

Commented:
If you change one of them, you change all of them.  That's a global property.

R.

Commented:
Hi!

Only bossible to make the whole form as graphical and remove the taskbar and draw own ones.
This is not "font weight" any more it's bitmap.

The API in this case is very problematic you can have one bar chanced, but the system will update them back.

Also this kind of modification may have bad effects in the other programs in case of freezes and malfunctions in may force to reboot I once tried to tamper the locales of app windows and that was not a solution.


Matti

Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
I know how to change these kind of thing for command button, let me do a little change to my code and maybe, i could post it...
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
See this link, pointing to a dll that does what you want:

http://www.codeguru.com/advancedui/CustomCaptions.shtml

Author

Commented:
well, looked at the at the link ritchie..not what i need..i just want to chnage the taskbar button for may pp so that it stands out in relation to any others..i am assuming this is not possible?
Basically my app tells a user how much money they owe and i'm using setwindowtext to constantly change it.
perhaps i could have my app buiild a bitmap every so often and have windows repaint the taskbar button with that bitmap?
any ideas, greatly appreciated .
regards
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
But, to change taskbar, you need to change caption itself.
You could change checking resize event, if it is vbminimized, you change, if not you stay normal.

Author

Commented:
ok. All i want to do is be able to change the style of my app's related taskbar button's text independantly of any others and at any time i may wish to do so.
When it is an inactive window the text is not bold, when it is active it is bold.
I want to have my apps taskbar button bold all of the time and red.

Can this be done?
CERTIFIED EXPERT
Commented:
Hi
TaskBar is actually TabStrip control with TCS_BUTTONS style. What do you need to do:
'==============================
'1. Get TaskBar handle:
'==============================

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Dim hTaskBar As Long

Public Function GetTaskBarWnd() As Long
   EnumChildWindows FindWindow("Shell_TrayWnd", vbNullString), AddressOf EnumChildProc, 0
   GetTaskBarWnd = hTaskBar
End Function

Function EnumChildProc(ByVal hWnd As Long, lParam As Long) As Long
   If GetWndClass(hWnd) = "SysTabControl32" Then
      hTaskBar = hWnd
      EnumChildProc = 0
   Else
      EnumChildProc = 1
   End If
End Function

Private Function GetWndClass(hWnd As Long) As String
   Dim k As Long, sName As String
   sName = Space$(128)
   k = GetClassName(hWnd, sName, 128)
   If k > 0 Then sName = Left$(sName, k) Else sName = "No class"
   GetWndClass = sName
End Function

'==============================
'2. Change style to OnerDraw
'==============================
SetWindowLong hTaskBar, GWL_STYLE,GetWindowLong(hTaskBar, GWL_STYLE) Or TCS_OWNERDRAWFIXED

'==============================
'3. Subclass hTaskBar
'==============================
'This is the most difficult thing. Windows in whole don't allow to subclass 'foreign' prpcesses and SetWindowLong hTaskBar, GWL_WNDPROC, AddressOf MyWndProc simply return 0. To do this you may use FileMapping technique for w95/98 and VirtualAllocEx for NT. After getting shared memory block with above technique, just place there jmp machine command to jump to your code.
jmp machine command is &HE9, following with your AddressOf value (Long). So your have to copy 6 bytes using CopyMemory. You should use CopyMemory twice:
CopyMemory pSharedAddress, ByVal &HE9, 2
CopyMemory pSharedAddress + 2, ByVal FARPROC(AddresOf MyWndProc), 4
'This trick is nesessary to avoid VB error of incorrect AddressOf using
Private Function FARPROC(ByVal ptr As Long) As Long
   FARPROC = ptr
End Function

'===========================
'4.Process your ownd drawing
'===========================

In MyWndProc you should wait for WM_DRAWITEM message with DIS.CtrlStyle = ODT_TAB (DIS - DRAWITEMSTRUCTURE) and perform any drawing/font changing on DIS.hdc


Cheers

Author

Commented:
much appreciated, will check it out as soon as.
thanks

Author

Commented:
danka shurn

Explore More ContentExplore courses, solutions, and other research materials related to this topic.