#include <iostream>
#include <windows.h>
using namespace std;
int main() {
HWND h = ::GetTopWindow(0 );
char t[100];
int x;
DWORD pid;
DWORD dwTheardId;
while ( h ) {
dwTheardId = ::GetWindowThreadProcessId( h,&pid);
x=GetWindowText(h,t,100);
cout<<h<<':'<<t<<':'<<pid<<';';
h = ::GetNextWindow( h , GW_HWNDNEXT);
}}