Sign in with
Sign up | Sign in
Your question

C# and System.Diagnostics.Process.Start

Last response: in Windows XP
Share
Anonymous
July 19, 2005 8:18:30 AM

Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

Hello,

I am running the following line of code within a non-web C#
application.

System.Diagnostics.Process.Start ("rundll32.exe
C:\\windows\\system32\\shimgvw.dll,ImageView_Fullscreen " + fileName);

where fileName = C:\Reports\D\2005-07-14\ActualTimesPage0001.emf

I receive the following error:

System.ComponentModel.Win32Exception: The system cannot find the file
specified
at
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)

I have registered shimgvw.dll as prior postings have suggested using
"regsvr32 shimgvw.dll." I have also verified as prior postings have
suggested the registry setting for the emffile folder command is
rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1

I do not receive an error when I run the command on the command line.

Your help will greatly be appreciated.

Thank you,
Anonymous
July 19, 2005 10:25:11 AM

Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

Here is a possible solution that I found.

// First create a ProcessStartInfo object.
// First parameter the rundll32.exe command.
// Second parameter the shimgvw.dll command along with the file name.
System.Diagnostics.ProcessStartInfo f = new
System.Diagnostics.ProcessStartInfo
("C:\\windows\\system32\\rundll32.exe",
"C:\\windows\\system32\\shimgvw.dll,ImageView_Fullscreen " +
fileName.TrimEnd (null));
try
{
// Pass the ProcessStartInfo object to the Start function.
System.Diagnostics.Process.Start (f);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine (ex.ToString ());
}
!