Home > Software engineering >  Virtual listview how to retrieve the text across processes
Virtual listview how to retrieve the text across processes

Time:09-28

Code is as follows: but how can obtain the location on the listview value, please help me, thank you,

//across processes for virtual ListView control the content of the
Void List_GetItemTextVirtual (HWND HWND, int row, int clo, char * pSave, int sz)
{
DWORD dwProcess;
HANDLE hProcess;
NMLVDISPINFO Info;

PSave [0]='\ 0';

GetWindowThreadProcessId (hWnd, & amp; DwProcess);
//the application memory
HProcess=OpenProcess (PROCESS_ALL_ACCESS, false, dwProcess);
NMLVDISPINFO * pTemp=(NMLVDISPINFO *) VirtualAllocEx (hProcess, 0, sizeof NMLVDISPINFO, MEM_COMMIT, PAGE_READWRITE);
If (0==pTemp)
{
MessageBox (0, "virtual memory allocation failure", 0, MB_OK);
}
Memset (& amp; Info, 0, sizeof Info);
Info. HDR. HwndFrom=hWnd;
Info. HDR. Code=LVN_GETDISPINFO;
Info. Item. Mask=LVIF_TEXT;
The Info. The item. The iItem=row;
Info. Item. ISubItem=clo;
Info. Item. CchTextMax=sz;
The Info. The item. The pszText=pSave;
DWORD DWORD=0;
WriteProcessMemory (hProcess, pTemp, & amp; Info, sizeof NMLVDISPINFO, & amp; DWord);
Int nChar=SendMessage (GetParent (hWnd), WM_NOTIFY, (WPARAM) GetDlgCtrlID (hWnd), (LPARAM) pTemp);
//read data
ReadProcessMemory (hProcess, pTemp, & amp; Info, sizeof NMLVDISPINFO, & amp; DWord);
//release the memory
VirtualFreeEx (hProcess, pTemp, sizeof NMLVDISPINFO, MEM_RELEASE);
The CloseHandle (hProcess);
Sprintf (pSave, "% s", the Info. Item. The pszText);
}

CodePudding user response:

Previously written, FYI
http://blog.csdn.net/l357630798/article/details/62417698
  • Related