hey guys,
What I want to do is when the user selects one of the currently running processes (will end in .exe), I want to open that process for reading/writing and also get its window name as well. Like for example, say the user selects RADASM.exe from the list, I want to open that process for reading/writing then get its actual window name. I have heard that you can do this using the id but am not quite sure how. This is what I have so far. Just need to know what api to use and how to use it to get the window name of the selected process:

invoke SendDlgItemMessage,hWin,IDC_CBO1,CB_GETCURSEL,0,0 ; Get selection
invoke SendDlgItemMessage,hWin,IDC_CBO1,CB_GETLBTEXT,eax,offset pName ;Get the Text of the Selection
invoke SetDlgItemText,hWin,IDC_EDT16,offset pName
Invoke FindWindowEx,NULL,NULL,NULL,offset pName ;Find the window that was selected
invoke GetWindowThreadProcessId,eax,offset dwprocessid ; The the Processes ID
invoke OpenProcess,PROCESS_ALL_ACCESS,NULL,dwprocessid ; Open for editing/writing
mov editprocess,eax ; Move ID to editprocess

Any help is appreciated,
Posted on 2003-02-13 21:43:35 by resistance_is_futile
There is no api to get the "window of a process", because there is no requirement for a process to have a window in the first place. In addition, a process can have more than one window associated with it so this complicates matters even more. The only way I can think of to accomplish this is to use EnumWindows to run through every window in the system. In EnumWindowsProc check the process id of the current window with GetWindowThreadProcessId and compare it to the process id you are looking for. Another thing you might want to check for is the WS_VISIBLE style because there are some applications that have hidden top-level windows that are not considered the "main window".
Posted on 2003-02-13 23:27:12 by BubbaFate
Posted on 2003-02-14 09:26:48 by bazik