Question on ListView_EditLabel

I want to rename a list view item in a manner similar to windows explorer that allows in place editing when rename is invoked from the drop-down/context menu. For this I used ListView_EditLabel in my application and passed it the handle to my list view control and the index of the selected item but its not working. Instead of returning me the handle to the edit control, ListView_EditLabel returns a NULL. What am I doing wrong?
nadirkamalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
The list view control must have the focus before you send ListView_EditLabel to the control. Focus can be set using the SetFocus function.
0
nadirkamalAuthor Commented:
I forgot to mention that I have already called SetFocus and ListView_EditLabel fails despite this.
0
NickRepinCommented:
Try to add LVS_EDITLABELS style to the listview.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

WynCommented:
I strongly suggest you take a look at listview column of www.codeguru.com.I write an application like yours and I learn alot there.
Just for you infor.
Regards
Wyn
0
nadirkamalAuthor Commented:
Thanks NickRepin
I added LVS_EDITLABELS and now I get a handle to the edit control. However, when I run the appication still the in place editing of the item doesn't get initiated. Do I have to to something with the edit control handle?
0
NickRepinCommented:
You have to handle LVN_BEGINLABELEDIT and LVN_ENDLABELEDIT notifications.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.