codice:#include <iostream> #include <windows.h> using namespace std; int main() { DWORD FirstGTC; HWND hWnd; DWORD dwID=0; HANDLE ProcHandle; hWnd = FindWindow(NULL, "Euro Truck Simulator"); if(!hWnd) { cerr<<"Cannot find the window."<<endl; return 1; } GetWindowThreadProcessId(hWnd, &dwID); ProcHandle = OpenProcess(SYNCHRONIZE, NULL, dwID); if(!ProcHandle) { cerr<<"Cannot open the process."<<endl; return 2; } FirstGTC = GetTickCount(); WaitForSingleObject(ProcHandle,INFINITE); cout<<"The process was running for "<<(GetTickCount()-FirstGTC)<<" milliseconds."<<endl; return 0; }