Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 7th, 2006, 05:15 AM
Friend of Wrox
Join Date: Mar 2005
Location: , , .
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default help coloring individual listview item instead al

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

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


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();

COLORREF color = 33023;

            TRACE("Color of the selected font = %8x\n", color);

            //CButton *pButton = (CButton*)GetDlgItem(IDC_BUTTON2);


        ::SendMessage(Dialog, LVM_SETTEXTCOLOR, 0, color);


Reply With Quote
  #2 (permalink)  
Old August 1st, 2006, 08:25 AM
Authorized User
Join Date: Jun 2003
Location: , , Norway.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts


You need to use a callback function i think (long time since I did this myself). Try to find some useful tips at Codeproject.com



Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get selected item from listview? try.test.abc C# 1 January 4th, 2007 02:34 AM
problem selecting listview item method Visual C++ 0 July 7th, 2006 04:06 PM
how to select an item from listview jthadathilm16 VB How-To 1 April 24th, 2006 11:33 AM
coloring datagrid preethi_04 .NET Framework 1.x 1 December 22nd, 2005 01:11 AM
Selecting a ListView item bmains Pro VB.NET 2002/2003 0 January 22nd, 2005 11:19 PM

All times are GMT -4. The time now is 12:41 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.