- Codice: Seleziona tutto
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <dos.h>
#include <process.h>
#include <unistd.h>
#pragma hdrstop
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lparam);
#pragma argsused
int main(int argc, char* argv[]) {
WinExec("\"C:\\Programmi\\Mozilla Firefox\\firefox.exe\" http://www.google.it", SW_SHOWNORMAL);
EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
system("pause");
return 0;
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, long lparam){
char buffer[80 + 1];
GetWindowText(hwnd, buffer, 80);
printf("%s\n", buffer);
mentre in questo in c++ si?
- Codice: Seleziona tutto
//---------------------------------------------------------------------------
#include <windows.h>
#include <iostream>
#pragma hdrstop
using namespace std;
//---------------------------------------------------------------------------
//Call Back Function For EnumWindows handle of every window unless you make it false after you get to a certain handle etc param is anything you want it to be so you can work with it inside the function
BOOL EnumWindowsProc(HWND hWnd, long lParam)
{
char Buff[255], NameOfClass[255];
GetWindowText(hWnd, Buff, 254);
GetClassName(hWnd, NameOfClass, 254);
cout << "Window Text: " << Buff << "\t" << "Class Name: "
<< NameOfClass << endl;
return TRUE;
}
#pragma argsused
int main(int argc, char* argv[])
{
EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
cin.ignore();
system("PAUSE");
return 0;
}