Set Desktop Icon text colour

Windows specific forum
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Set Desktop Icon text colour

Post by IdeasVacuum »

The code below (32bit app) works perfectly on Win7 but does not change the text colour on WinXP.
Anybody know why not?

Code: Select all

Procedure DesktopHandle()
;------------------------
;Same for XP and Win7
         Static hwndDesktop.i
         If Not hwndDesktop               ;Class    ;Window Title
                hwndDesktop = FindWindow_("ProgMan","Program Manager")
                hwndDesktop =  GetWindow_(hwndDesktop,#GW_CHILD) ;SHELLDLL_DefView
                hwndDesktop =  GetWindow_(hwndDesktop,#GW_CHILD) ;SysListView32
         EndIf

         ProcedureReturn hwndDesktop

EndProcedure

Procedure SetListViewTextFrontColour()
;-------------------------------------

Protected sClass.s = Space(128)
Protected   hwnd.i = DesktopHandle()

           GetClassName_(hwnd, @sClass, 127)

           If (sClass = "SysListView32")

                     SendMessage_(hwnd,#LVM_SETTEXTCOLOR,#Null,RGB(0,0,255))
                  InvalidateRect_(hwnd,#Null,#True)
                    RedrawWindow_(hwnd,0,0,#RDW_UPDATENOW)
           EndIf

EndProcedure

SetListViewTextFrontColour()
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Set Desktop Icon text colour

Post by IdeasVacuum »

I have discovered the issue on XP - the default text uses a drop-shadow effect. If the drop shadow is off, the text colour can be changed same as Win7.

To switch off the shadow manually un-tick the option:
Control Panel-->System-->Advanced-->Performance Settings-->Visual Effects-->Use drop shadows for icon labels on the desktop

So, the question now is - how to switch off that drop shadow programmatically?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply