Is there a way to change text background color of the items in Windows Explorer in Windows 7?
delphi, delphi-xe2, winapi, windows-7, windows-explorer
Solution
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).
Problem
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 ?