Devolver la manija de la ventana por su nombre / título
No puedo resolver este problema. Me sale un error:
The name 'hWnd' does not exist in the current context
Suena muy fácil y probablemente ... disculpe las preguntas tan obvias.
Aquí está mi código:
public static IntPtr WinGetHandle(string wName)
{
foreach (Process pList in Process.GetProcesses())
{
if (pList.MainWindowTitle.Contains(wName))
{
IntPtr hWnd = pList.MainWindowHandle;
}
}
return hWnd;
}
Lo intenté de muchas maneras y cada uno falla. Gracias por adelantado.