Es simple pero efectiva!
Código: Seleccionar todo
int SacPidDeVent( char* Ventana_Pid )
{
HWND ventana;
DWORD pid;
HANDLE phandle;
/*Buscamos la Ventana!*/
ventana = FindWindow(NULL,Ventana_Pid);
if( !ventana){
printf(" \n");
printf("ERROR! La Ventana Seleccionada No Esta Activa!");
getch();
return 0;
}
/*Obteneos el PID del proceso del juego a atraves de la ventana y lo metemos es el "pid"*/
GetWindowThreadProcessId(ventana , &pid);
return pid;
}
Código: Seleccionar todo
int pid = SacPidDeVent ( "Nombre_De_La_Ventana!");
Correciones y o recomendaciones son aceptadas!