المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Windows Message API problem for LVM_GETITEMTEXT



C++ Programming
04-02-2009, 10:09 AM
Hi All,

I am trying to read text from ListView of other application.

I have created a demo application which is working fine for all listview (FolderView/ Winzip Listview control and listview of some application), but it is not working for a particular Listview.

I am able to get the RowCounts/ Column Counts but I am not able to read text.

Below is my code which I am executing to get ListItem.

The original code is in VB6, but Message API code/messages are similar in VC++/MFC.

Private Const LVM_FIRST = &H1000
Private Const LVM_GETITEMCOUNT = (LVM_FIRST + 4)

Private Const LVM_GETITEM = (LVM_FIRST + 5)
Private Const LVM_GETSTRINGWIDTH = (LVM_FIRST + 17)
Private Const LVM_GETCOLUMN = (LVM_FIRST + 25)
Private Const LVM_GETITEMTEXT = (LVM_FIRST + 45)

strLength = SendMessage(hWindow, LVM_GETITEMTEXT, iItem, ByVal pMyItemMemory)

Above code is working fine for other listview, and strLength is returning currect length of text of the List item.

I tried to debug, and understand nature of window (Listview Window) and I observed that all other listview where it is working fine having Windows Proc as Unicode and for list where it is not working having Windows Proc as ANSI (I got this information using Windows Spy++ utility).

My understanding is to get listview item for ANSI strings there would be different message needs to pass.

I appreciate your time and thanking you for any help or direction.

Regards
Rushi