18 static void Main(
string[] args)
22 string RegAsm = Path.Combine(Environment.ExpandEnvironmentVariables(
"%systemroot%"),
"Microsoft.NET",
"Framework",
System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion(),
"regasm.exe");
23 if (File.Exists(RegAsm))
25 string ComObject = Path.Combine(
new FileInfo(
System.Reflection.Assembly.GetEntryAssembly().Location).Directory.FullName,
"DirectOutputComObject.dll");
26 if (File.Exists(ComObject))
29 System.Diagnostics.ProcessStartInfo ProcStartInfo =
new System.Diagnostics.ProcessStartInfo();
30 ProcStartInfo.FileName = RegAsm;
31 ProcStartInfo.Arguments =
"\"" + ComObject +
"\" /silent /nologo /codebase";
33 ProcStartInfo.RedirectStandardOutput =
true;
34 ProcStartInfo.UseShellExecute =
false;
36 ProcStartInfo.CreateNoWindow =
true;
39 System.Diagnostics.Process Proc =
new System.Diagnostics.Process();
40 Proc.StartInfo = ProcStartInfo;
43 Result = Proc.StandardOutput.ReadToEnd();
46 if (Proc.ExitCode == 0 && Result.Length == 0)
48 MessageBox.Show(
"DirectOutput COM object successfully registered.",
"DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Information);
52 MessageBox.Show(
string.Format(
"Registering the DirectOutput COM object returned the following information:\nExit Code: {0}\nMessage: {1}", Proc.ExitCode, Result),
"DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Error);
57 MessageBox.Show(
string.Format(
"Could not register the DirectOutput COM object, since the file could not be found.\nMissing file: {0}", ComObject),
"DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Error);
62 MessageBox.Show(
string.Format(
"Could not register the DirectOutput COM object, since the regasm.exe could not be found.\nMissing file: {0}", RegAsm),
"DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Error);
Namespace for the DirectOutputComObjectRegister application.
Main class of the DirectOutputComObjectRegister application.