I think this solves what you want:
#include <iostream>
#include <windows.h>
using namespace std;
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int iCmdShow) {
EnumWindows(EnumWindowsProc, NULL);
return 0;
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) {
char class_name[80];
char title[80];
GetClassName(hwnd,class_name, sizeof(class_name));
GetWindowText(hwnd,title,sizeof(title));
cout <<"Window title: "<<title<<endl;
cout <<"Class name: "<<class_name<<endl<<endl;
return TRUE;
}
I put in the Github for future reference.
If you don’t do exactly what you want the way is this to adapt.
Documentation.
According to the comments I found this other solution in the OS that filters the windows that are active. It is in C and is more complex but seems to solve at least part of the problem.
Post a part of the code you already tried. You are using some framework/library?
– jlHertel
The Problem Is I Haven’t Tried Pq Yet Don’t Know. No, I’m Using Normal C++ Only A <iostream> and <Windows. h>
– axell-brendow
Use
<windows.h>
not using normal C++ .– Maniero
It’s I Know aushua, I wavered Msm.
– axell-brendow