【发布时间】:2012-11-12 21:56:07
【问题描述】:
我无法解决这个问题。 我收到一个错误:
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;
}
我尝试了许多不同的方法,但都失败了。 提前致谢。
【问题讨论】: