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 ?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With