ProcessStartInfo startInfo=new ProcessStartInfo()
{
WindowStyle=ProcessWindowStyle.Normal,
FileName=fileName,
Verb="openas",
UseShellExecute=true,
ErrorDialog=true,
};
p=Process.Start(startInfo);
Well to solve this issue I needed to check how the system used to show the open as dialog. As a result, I ended up with this line of code which brings up the open as dialog as usual.
p=Process.Start("rundll32.exe", string.Format("shell32,OpenAs_RunDLL \"{0}\"", fileName));
By the way, you'll need both versions if you want that your application works on Windows XP and later versions. This line indicates whether the application is running on Windows Vista or later.
Environment.OSVersion.Platform==PlatformID.Win32NT && Environment.OSVersion.Version>=new Version(6, 0, 6000);
Thank you very much for posting this. It's kind of a nasty work around in my humble opinion, but it resolves an even more irritating problem.
ReplyDeleteThanks for your comment, I'm glad this solution helped you too. You're right, it's very irritating that the 'openas' mechanism has changed so it doesn't work the same way as it did before.
ReplyDelete