Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to change text background color of the items in Windows Explorer in Windows 7?

http://screenshots.en.sftcdn.net/en/scrn/39000/39972/xentient-labels-1.jpg

Is is possible to change background color of the items in Windows Explorer like the Xentient Labels application does ? Is it possible to do so from Delphi XE2 in Windows 7 ?

like image 838
Gu. Avatar asked Dec 13 '22 02:12

Gu.


1 Answers

It's not possible to do this in Windows 7 since the Windows Explorer's list view uses the DirectUIHWND not SysListView32 as it was in Windows XP. The DirectUIHWND class control doesn't listen the list view messages, so you cannot use the ListView_SetTextBkColor macro to change text back color as you could on Windows XP.

With the following simple test you can verify it. Let's have an edit box and button on the form. In that edit box enter the handle to the Windows Explorer's list view control (obtained e.g. by Spy++) and in button's press run the following code:

uses
  Winapi.CommCtrl;

procedure TForm1.Button1Click(Sender: TObject);
var
  ListViewHandle: HWND;
begin
  ListViewHandle := StrToInt(Edit1.Text);
  ListView_SetTextBkColor(ListViewHandle, $0000CCFF);
end;

This Spy++ screenshot from Windows 7 shows the class name of the Explorer's list view (in Windows XP it was SysListView32 controllable by standard list view messages, the DirectUIHWND doesn't react to them).

enter image description here

like image 142
TLama Avatar answered May 16 '23 08:05

TLama