Originariamente inviato da maluz1
Ma scusa ma se io metto in un timer la findwindow, appena l applicazione vieni chiusa, dovrebbe risultarmi il null o qualcosa del genere , quindi appena mi risulta null o quella roba li, il problema e risolto... No?
Sì ... ed è quello che ti dicevo ... devi essere tu periodicamente a chiamare la API, non la API a chiamare te.

Potresti usare anche l'hook ma te lo sconsiglio per la maggiore difficoltà di implementazione e il peso sul sistema.

Invece non ho capito molto dei parametri che devo passare alla findwindow... ?
Cosa non capisci dei parametri dalla documentazione ?

Parameters
lpClassName [in, optional]
Type: LPCTSTR

The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero.
If lpClassName points to a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.


lpWindowName [in, optional]
Type: LPCTSTR

The window name (the window's title). If this parameter is NULL, all window names match.