设置活动窗口
|
我正在尝试制作一个提供地震样式下拉HUD控制台的应用程序。我可以显示和隐藏窗口,但显示后无法弄清楚如何将其设置为活动窗口。我使用Win API调用来显示和隐藏窗口。我尝试了SetForegroundWindow(IntPtr hWnd)和SetFocus(IntPtr hWnd)无济于事。有人有想法么?
http://pastebin.com/DgtJJGiv
public void ShowApp()
{
IntPtr h = FindWindow(null, \"C:\\\\Windows\\\\system32\\\\cmd.exe\");
ShowWindow(h, SW_SHOW);
//EnableWindow(h, true);
isHidden = false;
// set focus to console window
SetForegroundWindow(h);
System.Diagnostics.Debug.WriteLine(h);
}
没有找到相关结果
已邀请:
4 个回复
耐钨徒
我最初只是将TopMost设置为true,但是在表单后面显示对话框时遇到了问题。似乎将TopMost设置为true会将表单拉到最前面并保持在那里。将其设置为false不会将其后退,但会允许其他形式显示在前面。我仍然无法集中精力,因此我进行了以下工作:
爆山
winAPI方法。希望这可以帮助...
春驹晴陪
冲汉