Need Help With EnumDesktopWindows And More..
I'm trying to get a list of all the handles of all the windows that are running on my computer. It's giving an "access violation" error and I'm not surprised since I'm in way over my head. Not like that's stopped me before. :)
Here's the code:
Code:
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <windows.h>
using namespace std;
int main(){
HWND hwnd = 0; // probably initializing this wrong
DWORD dwThreadId = GetCurrentThreadId(); // Get the current thread id
HDESK hDesktop = GetThreadDesktop(dwThreadId); // Assign the desktop thread id to hDesktop
LPARAM lParam(0); // almost definitely initializing this wrong
WNDENUMPROC lpfn(0); // same for this
string windowName = " ";
cout << "--------------\n";
cout << "Swarm 1.0.0\n";
cout << "by Nemesis\n";
cout << "--------------\n";
cout << "--------------\n";
cout << "Searching For Windows... ";
EnumDesktopWindows(hDesktop, EnumWindowsProc(), lParam);
/*if(){ // wanted some way to check or list enumeration, but ended up commenting this out for now
cout << "Enumeration successful.";
}else{ cout << "Enumeration unsuccessful.";}*/
system("PAUSE");
return 0;
}