-
Автор темы
- #1
it can be used for external/kernel cheats
Код:
bool is_window_active( ) {
HWND foreground_window = GetForegroundWindow( );
if ( foreground_window == NULL ) {
return false;
}
// get the window title length.
int title_length = GetWindowTextLength( foreground_window );
if ( title_length == 0 ) {
return false;
}
// allocate buffer to store the window title.
TCHAR* title_buffer = new TCHAR[ title_length + 1 ];
// get the window title.
if ( GetWindowText( foreground_window, title_buffer, title_length + 1 ) == 0 ) {
delete[ ] title_buffer;
return false;
}
// compare the window title.
bool result = ( _tcscmp( title_buffer, TEXT( "Counter-Strike 2" ) ) == 0 );
delete[ ] title_buffer;
return result;
}