この問題を解決できません。エラーが発生します:
The name 'hWnd' does not exist in the current context
とても簡単に聞こえますが、おそらく... 当たり前の質問をして申し訳ありません。
これが私のコードです:
public static IntPtr WinGetHandle(string wName)
{
foreach (Process pList in Process.GetProcesses())
{
if (pList.MainWindowTitle.Contains(wName))
{
IntPtr hWnd = pList.MainWindowHandle;
}
}
return hWnd;
}
私は多くの異なる方法で試しましたが、いずれも失敗しました。前もって感謝します。