Click here to Skip to main content
Licence CPOL
First Posted 9 Aug 2008
Views 18,301
Downloads 904
Bookmarked 13 times

How to edit listview subitems in Win32

By | 9 Aug 2008 | Article
Shows how to edit listview subitem text without using MFC.

Introduction

This is the first article I submit to CodeProject so I want the more experienced members to help me. I don't known English very well, but I'll try my best.

This article tries to explain how to allow listview controls to edit its subitems like in spreadsheet controls. The code is written using the Win32 Native API as a counterpart of existing code written in MFC. Please tell me what you think and what I can do to improve it. Thanks in advance.

Using the code

In order to use the code, you must use two files: "StrViewWnd.cpp" and "StrViewWnd.h". These two files are fully commented to explain what each line of code does.

1. Creating the control

case WM_CREATE:
{
    // Here create the listview
    CreateStringView(hWnd,ID_LIST);
    ...
}
break;

2. Processing control notifications

case WM_NOTIFY:
{
    LPNMHDR lpnmHdr = (LPNMHDR)lParam;

    switch(lpnmHdr->idFrom)
    {
        // catch its notify events
        case ID_LIST: // ID_LIST is the listview id
            return OnStrViewNotify(wParam,lParam);
    }
}
break;

3. Reverting changes

case WM_DESTROY:
        // call Revert() to restore original listview window procedure
        Revert();
        PostQuitMessage(0);
        break;

Ending

Well, that's all. I hope you enjoy it. Please send me your opinions, suggestions, etc.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

yosmany

Software Developer

Cuba Cuba

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralJust perfect! Big thanks! :-) Pinmemberjur200210:46 25 Nov '09  
QuestionIn a dialog? Pinmemberlamerjack7:08 2 Mar '09  
AnswerRe: In a dialog? Pinmemberkoloko10:51 27 Oct '09  
GeneralThanks! Pinmemberpriling2221:35 16 Dec '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 9 Aug 2008
Article Copyright 2008 by yosmany
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid