Windows Message API problem for LVM_GETITEMTEXT
-
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. <pre>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)</pre> 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
-
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. <pre>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)</pre> 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
You could specifically try to use
SendMessageA
.«_Superman_» I love work. It gives me something to do between weekends.
-
You could specifically try to use
SendMessageA
.«_Superman_» I love work. It gives me something to do between weekends.
Hi Superman :) , Thank you for your prompt reply. But i guess I am using SendMessageA only see my declaration.
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
</pre>Regards
Rushi