help coloring individual listview item instead of all listview item in visual c++

Joined
Jun 30, 2005
Messages
59
Reaction score
0
Hi all. i am using this code to change color of listview item. But unfortunetly it goes and changes color of all item instead of only changing the color selected listview item. Could an expert look at this and show me how i can only change color of selected listview item instead of coloring all items in listview.Thanks




Code:
void CColor1Dlg::OnButton1() 
{
HWND hPalWnd = ::FindWindow("my window class", NULL);
		HWND spilterwindow = FindWindowEx(hPalWnd, 0, "WTL_SplitterWindow", 0);
		spilterwindow = FindWindowEx(spilterwindow, 0, "WTL_SplitterWindow", 0);
		HWND ATL = FindWindowEx(spilterwindow, 0, "WTL_SplitterWindow", 0);
		HWND ATLWIN = FindWindowEx(ATL, 0, "atl:0053c8d0", 0);
		HWND Dialog = FindWindowEx(ATLWIN, 0, "SysListView32", 0);
		HWND Rich = FindWindowEx(Dialog, 0, "SysHeader32", 0);
 
			CButton *pButton1 = (CButton*)GetDlgItem(IDC_BUTTON1);
			COLORREF GetBkColor(IDC_BUTTON1);
			//COLORREF color = m_color.GetColor();
[b]COLORREF color = 33023;[/b]
			TRACE("Color of the selected font = %8x\n", color);
			//CButton *pButton = (CButton*)GetDlgItem(IDC_BUTTON2);
			//pButton->SetWindowText("Shoot");
		[b]::SendMessage(Dialog, LVM_SETTEXTCOLOR, 0, color);[/b]
 
}
 
Back
Top