I am trying to get all open windows on windows. I have looked around and seen that I should use EnumWindows and EnumWindowsProc so I whipped up this code to test it but it tells me there's 300-400 windows open, and I only have about 5?
Code:
#include <windows.h> #include <iostream> int i; BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); int main(int argc, char** argv) { std::cout << "Finding all open windows\n"; if(EnumWindows(EnumWindowsProc, 0)) { std::cout << i << " windows are open\nCall was successful...\n" << std::endl; std::cin.get(); } else { std::cout << "Call was unsuccessful...\n" << std::endl; std::cin.get(); } return 0; } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { i++; return true; }
Comment