PDA

View Full Version : C# and System.Diagnostics.Process.Start



nd123rw456@yahoo.com
19-07-2005, 09:40 PM
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_Fulls creen " + 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_Fullscre en %1

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

Your help will greatly be appreciated.

Thank you,

nd123rw456@yahoo.com
19-07-2005, 11:30 PM
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_Fulls creen " +
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 ());
}

Hosted by: Eyo Technologies Pty Ltd. Sponsored by: Actiontec Pty Ltd