I'm trying to hook into another process to increase functionality (no malintent here), and I've come up with the following code:
DebugActiveProcess() returns non-zero, so I must have the hook. However, I still can't retrieve the edit control text, ie, I still don't have full access to the other process's windows. Is this the right approach?Code:hFind=FindWindow("myWindowClass",NULL); GetWindowThreadProcessId(hFind,&dwProcID); if (!DebugActiveProcess(dwProcID)) exit(1); hChildFind=FindWindowEx(hFind,NULL,"EDIT",NULL); GetWindowText(hChildFind,chName,255);
EDIT: Another problem: the target process exits when the debugger process does. I searched, but can't find out how to detach the hook. Any ideas?