I am trying to get the text of elements in a listview of another process. I found a great CodeProject tutorial. Thanks to this article, I was able to do this on x32. But when you try to run on x64, this will crash the application that I am trying to access when SendMessage is called. In the comments to the articles, people had problems due to the different sizes of the pointer. Some people have suggested using the x64 compiler, which I cannot use. I need my program to run on x32 / x64. One guy suggested:
I have an answer. LVITEM is an incorrect structure in a 64-bit system. Pointers are now 64-bit, so a dummy value should be followed by a text pointer to compensate for the length of the member correctly.
I think this would be a better solution, since I could run it for x32 and x64 with one exe. I just donβt know how to do what the hydropower plant says. I have included my code, which currently runs on x32. If anyone can help me. It would be nice.
LVITEMLVITEM lvi, *_lvi; char item[512]; char *_item; unsigned long pid; HANDLE process; GetWindowThreadProcessId(procList, &pid); process = OpenProcess(0x001f0fff, FALSE, pid); _lvi = (LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM), 0x1000, 4); _item = (char*)VirtualAllocEx(process, NULL, 512, 0x1000, 4); lvi.cchTextMax = 512; int r, c; for (r = 0; r < rowCount; r++) { for (c = 0; c < columnCount; c++) { lvi.iSubItem = c; lvi.pszText =_item;
source share