我使用這個代碼現在:問題WindowStyle和的ProcessStartInfo
ProcessStartInfo startInfo = new ProcessStartInfo();
Process process = new Process();
private void button1_Click(object sender, EventArgs e) {
startInfo.FileName = @"D:\קוד C#\WindowsFormsApplication11\WindowsFormsApplication11\obj\x86\Debug\WindowsFormsApplication11.exe";
// startInfo.Arguments = "-console -game cstrike +map de_dust +maxplayers 16 -port 27017";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo = startInfo;
process.Start();
}
private void button2_Click(object sender, EventArgs e) {
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
}
的代碼實際上是工作得很好,但問題是:
當我啓動程序(點擊button1
)該程序運行爲「隱藏」(如我所願)。但是我怎樣才能改變它不在hidden
模式?
另一個問題:
那麼如果程序無法進入hidden
模式?那我該怎麼辦?
你能更具體一點嗎?按Button2時它會隱藏嗎? –
如果你想改變窗口的過程開始後,你可以使用FindWindow Win32 API獲取窗口,並改變其可見性... –
只有當我按下按鈕1時隱藏進程。當我按下按鈕2沒有什麼好事,它的支持得到最大化; –