This callback function is called when I press a button, but I wanted to pass the handle out of it to use it in another button or something else, and use openprocess out of it. How?
Thanks.
Code:static BOOL CALLBACK EnumWindowsProcb(HWND hwnd, LPARAM lParam) { if (hwnd) { DWORD pid; char windowname[1024]; GetWindowText(hwnd, windowname, 100); if (strstr(windowname, "Untitled - Notepad")) { DWORD pidx; GetWindowThreadProcessId(hwnd, &pidx); if(pidx == lParam) { HANDLE hProcess = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_VM_READ | PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, (DWORD) pid); } } return TRUE; }




Reply With Quote