Originally posted by _Unregistered_
How can I use Enum windows for Win3.x app? And not crash...
What's the correct way to use it, when to put it?
According to the SDK you need 95 or NT3.1 AT LEAST........
Why are you using such an outdated OS?
Originally posted by _Unregistered_
Loop is ideal for this application, is it?
Nope....you need a callback....if you have an os that allows this fuction you would do something along the lines of
Code:
#include <windows.h>
#include <iostream>
using namespace std;
BOOL CALLBACK EnumProc(HWND hwnd,LPARAM lParam);
int nNoWnd = 0;
int main(void)
{
cout << "Enumerating..." << endl;
EnumWindows((WNDENUMPROC) EnumProc,NULL);
cout << "Total of " << nNoWnd << " windows" << endl;
return 0;
}
BOOL CALLBACK EnumProc(HWND hwnd,LPARAM lParam)
{
char buff[MAX_PATH+1];
if(GetWindowText(hwnd,buff,MAX_PATH+1) <= 0)
cout << "\"No Title\"" << endl;
else
cout << buff << endl;
nNoWnd++;
return TRUE;
}