Trying to mimic
-
Hi all. Im trying to make the same function but with a console instead of a Window app. The code is from this site here: http://www.codeproject.com/system/Hack\_Windows\_Task\_Manager.asp From what i can see in my version i've done everything right but its not doing the desired task which is to wipe the list in task manager. Here's what i have.
#include #include using namespace std; BOOL CALLBACK EnumChildProcedure(HWND hWnd, LPARAM lParam); void main(){ HWND taskmnger = ::FindWindow(NULL,"Windows Task Manager"); if(taskmnger){ cout << "Task Manager window found! " << endl; EnumChildWindows(taskmnger,EnumChildProcedure,NULL); } else{ cout << "Not found! " << endl; } } BOOL CALLBACK EnumChildProcedure(HWND hWnd,LPARAM lParam) { char name[256]; GetWindowText(hWnd,name,256); char ClassName[256]; GetClassName(hWnd,ClassName,256); if((strcmp(ClassName,"SysListView32")==0)&&(strcmp(name,"Processes")==0)) { cout << "Process tab Found! " << endl; } if((strcmp(ClassName,"SysListView32")==0)&&(strcmp(name,"Tasks")==0)) { cout << "Task tab Found! " << endl; } if(name==NULL) return FALSE; return TRUE; }
Im thinking my problem lies in the SendMessage function. Everything else seems to work. EnumChildWindows() and the Enum function all detect the lower windows. But when it finds the windows, it doesnt pretty much do anything. :confused: So if anyone has any suggestion as to what im missing please let me know. Thanx in advance!