扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
以下是引用片段: private void btnCreate_Click(object sender, EventArgs e) ...{ int hWnd = FindWindow(null, "test");//窗體的名稱 //check if PowerReuse is launched or not //if yes, pass path of project to PowerReuse //or, launch PowerReuse with specified parameter if (hWnd > 0) ...{ MessageBox.Show("powerReuse has been launched already." + " " + hWnd.ToString()); //SendMessage to PowerReuse return; } try ...{ Process Main_P = new Process(); //this path should be retrieved from Windows Registry, //the loaction is written by Installter during process of installation. Main_P.StartInfo.FileName = @"C: est.exe";//運行的exe路徑 //This URL is passed to PowerReuse to open Main_P.StartInfo.Arguments = @"C:Tempabc.prj";//運行時的參數 Main_P.StartInfo.UseShellExecute = true; Main_P.Start(); // //we have to wait for a while until UI has been initialized // Main_P.WaitForInputIdle(10000); //although UI has been initialzied, // //we may wait for another 10 seconds for (int i = 0; i < 100; i++) ...{ hWnd = FindWindow(null, "PowerReuse (Beta)"); //hWnd = Main_P.MainWindowHandle.ToInt32() ; if (hWnd > 0) break; Thread.Sleep(100); } //Here, we check if PowerReuse is fully launched if (hWnd == 0) ...{ //Handle exception MessageBox.Show("We cannot find window handle of PowerReuse"); } else ...{ //other handling // MessageBox.Show(hWnd.ToString() + " " + Main_P.MainWindowHandle.ToString() + " " + Main_P.MainWindowTitle); } } catch (Exception ex) ...{ MessageBox.Show(ex.Message); } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者