我正在编写一种PC预订应用程序(C#中的客户端),所有操作都已完成,除非我在用户登录PC(Windows 7 / Vista)时尽快启动它,即我想以某种方式覆盖explorer.exe。
我尝试用explorer.exe替换我的应用程序,
“HKLM \ Software \ Microsoft \ Windows NT \ CurrentVersion \ Winlogon \ Shell”
它可以工作,但是当我尝试在我的应用程序中启动explorer.exe时,
const string explorer = "explorer.exe";
string explorerPath = string.Format("{0}\\{1}", Environment.GetEnvironmentVariable("WINDIR"), explorer);
Process eProcess = new Process();
eProcess.StartInfo.FileName = explorerPath;
eProcess.StartInfo.UseShellExecute = true;
eProcess.StartInfo.CreateNoWindow = true;
eProcess.Start();
eProcess.WaitForInputIdle();
它只是挂起并且不会启动资源管理器。
我还尝试了许多其他“变通办法”,以便根据
开始使用不同的注册表项http://technet.microsoft.com/en-us/magazine/ee851671.aspx
但似乎没有一个在Windows 7 / Vista中100%有效。在XP中它似乎更好。
BTW:UAC在所有将运行的机器上关闭。
任何建议都会很好 - 现在我被卡住了。
感谢。
答案 0 :(得分:0)
不要eProcess.WaitForInputIdle();
,它会起作用。