want to read text from ListView control with class style LVS_OWNERDATA

To add comments, please log in or register
Denis Sartakov
1545
Denis Sartakov  

hi dear friends.

i have deals with MT5 open positions list that is implemented as ListView control with class style LVS_OWNERDATA.

i enjected into MT5 own DLL and try to read text for <item,subutem> but failed, need help or advice...

here is my DLL part of code:

        NMLVCACHEHINT k_NMLVCACHEHINT;
        memset(&k_NMLVCACHEHINT,0,sizeof(k_NMLVCACHEHINT));
        k_NMLVCACHEHINT.hdr.hwndFrom = h_SysListView32;
        k_NMLVCACHEHINT.hdr.idFrom   = GetDlgCtrlID(h_SysListView32);
        k_NMLVCACHEHINT.hdr.code     = LVN_ODCACHEHINT;
        k_NMLVCACHEHINT.iFrom     = 0;
        k_NMLVCACHEHINT.iTo       = 3;
        SendMessage(GetParent(h_SysListView32),WM_NOTIFY,(WPARAM)k_NMLVCACHEHINT.hdr.idFrom,(LPARAM)&k_NMLVCACHEHINT);


        TCHAR  t_LVtext[200];
        memset(t_LVtext,0,sizeof(t_LVtext));
        int    i_LVtextMax = 200;

        NMLVDISPINFO k_NMLVDISPINFO;
        memset(&k_NMLVDISPINFO,0,sizeof(k_NMLVDISPINFO));
        wcscpy(t_LVtext,TEXT("Initialcontent ")); 

        k_NMLVDISPINFO.hdr.hwndFrom = h_SysListView32;
        k_NMLVDISPINFO.hdr.idFrom   = GetDlgCtrlID(h_SysListView32);
        k_NMLVDISPINFO.hdr.code     = LVN_GETDISPINFO;

        k_NMLVDISPINFO.item.mask       = LVIF_TEXT;
        k_NMLVDISPINFO.item.state      = 0;
        k_NMLVDISPINFO.item.stateMask  = 0;
        k_NMLVDISPINFO.item.pszText    = (LPTSTR)t_LVtext;
        k_NMLVDISPINFO.item.cchTextMax = i_LVtextMax;

        k_NMLVDISPINFO.item.iItem    = 1;
        k_NMLVDISPINFO.item.iSubItem = 3;

        ListView_SetItemState(h_SysListView32, -1, 0, LVIS_SELECTED); // deselect all items
        SendMessage(h_SysListView32,LVM_ENSUREVISIBLE,(WPARAM)k_NMLVDISPINFO.item.iItem,FALSE); // if item is far, scroll to it
        ListView_SetItemState(h_SysListView32,k_NMLVDISPINFO.item.iItem,LVIS_SELECTED,LVIS_SELECTED); // select item
        ListView_SetItemState(h_SysListView32,k_NMLVDISPINFO.item.iItem,LVIS_FOCUSED,LVIS_FOCUSED); // optional

        wcscpy(pt_Result,TEXT("<iItem,iSubItem> = ")); 
        SendMessage(GetParent(h_SysListView32),WM_NOTIFY,(WPARAM)k_NMLVDISPINFO.hdr.idFrom,(LPARAM)&k_NMLVDISPINFO);
        wcscat(pt_Result,t_LVtext); 
        SendMessage(GetParent(h_SysListView32),WM_NOTIFY,(WPARAM)LVN_GETDISPINFO,(LPARAM)&k_NMLVDISPINFO);
        wcscat(pt_Result,t_LVtext); 
To add comments, please log in or register