#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
LVFINDINFO information;
POINT poss;
LVITEM lvi;
void main(void) {
HWND father = FindWindow(NULL, "Gerenciador de Tarefas do Windows");
HWND child = FindWindowEx(father, 0, NULL, NULL);
HWND listview = FindWindowEx(child, 0, "SysListView32", "Processos");
DWORD PID;
GetWindowThreadProcessId(listview, &PID);
HANDLE process = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ | PROCESS_QUERY_INFORMATION,
FALSE, PID);
lvi.cchTextMax = 512;
LPVOID address = VirtualAllocEx(process, NULL, sizeof(LVITEM), MEM_COMMIT, PAGE_READWRITE);
lvi.iSubItem = 0;
printf("%i\n", address);
WriteProcessMemory(process, address, &lvi, sizeof(lvi), NULL);
int indice = SendMessage(listview, LVM_GETITEMTEXT, 1, (LPARAM)&address);
printf("%i\n", indice);
}
我试图从任务管理器中列出的进程中获取文本但是没有成功,因为当我运行任务管理器代码时它停止工作。我该如何解决这个问题?