MINIMIZED C#運行應用程序,我得到了下面的代碼在Windows啓動時運行應用程序:在Windows啓動時
private void SetStartup(string AppName, bool enable)
{
string runKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
Microsoft.Win32.RegistryKey startupKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(runKey);
if (enable)
{
if (startupKey.GetValue(AppName) == null)
{
startupKey.Close();
startupKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(runKey, true);
startupKey.SetValue(AppName, Application.ExecutablePath.ToString());
startupKey.Close();
}
}
else
{
startupKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(runKey, true);
startupKey.DeleteValue(AppName, false);
startupKey.Close();
}
}
它的工作原理。但我希望程序開始最小化(僅在Windows啓動時)。 我沒有找到一個工作代碼/很好的解釋如何做到這一點。 你能幫我嗎?
謝謝。
你也可以創建一個鏈接文件(* .lnk)來啓動最小化集合,但我更喜歡這個答案。 – VVS 2010-12-15 19:41:01
如何讀取參數? – Ron 2010-12-15 20:04:40
@Ron:看看這個:http://msdn.microsoft.com/en-us/library/96s74eb0(v=vs.80).aspx – DReJ 2010-12-15 20:10:05