Get Startup path, application name and vendor


   
 
  using System;
  using System.Windows.Forms;
  using Microsoft.Win32;

  public class MyMessageFilter : IMessageFilter 
  {
    public bool PreFilterMessage(ref Message m) 
    {
      // Intercept the left mouse button down message.
      if (m.Msg == 513) 
      {
        Console.WriteLine("WM_LBUTTONDOWN is: " + m.Msg);
        return true;
      }
      return false;
    }
  }

  public class mainForm : System.Windows.Forms.Form
  {
    private MyMessageFilter msgFliter = new MyMessageFilter();

    public mainForm()
    {
      GetStats();
      Application.ApplicationExit += new EventHandler(Form_OnExit);
      Application.AddMessageFilter(msgFliter);    
    }

    [STAThread]
    static void Main() 
    {
      Application.Run(new mainForm());
    }

    private void GetStats()
    {
      Console.WriteLine(Application.CompanyName+ "  Company:");
      Console.WriteLine(Application.ProductName+ " App Name:");
      Console.WriteLine(Application.StartupPath);
    }

    // Event handlers.
    private void Form_OnExit(object sender, EventArgs evArgs) 
    {
      Console.WriteLine("Exit", "This app is dead...");
      Application.RemoveMessageFilter(msgFliter);
    }
  }



           
         
     


Create DLL library

   


// DllTestServer.cs
// build with the following command line switches
//     csc /t:library DllTestServer.cs
public class DllTestServer
{
 public static void Foo()
 {
  System.Console.WriteLine("DllTestServer.Foo (DllTestServer.DLL)");
 }
}
//////////////////////////////////////////////////////////
// DllTestClient.cs
// build with the following command line switches
//     csc DllTestClientApp.cs /r:DllTestServer.dll 
using System;
using System.Diagnostics;
using System.Reflection;

class DllTestClientApp
{
    public static void Main()
    {
        Assembly DLLAssembly = Assembly.GetAssembly(typeof(DllTestServer));
        Console.WriteLine("
DllTestServer.dll Assembly Information"); 
        Console.WriteLine("	" + DLLAssembly);

        Process p = Process.GetCurrentProcess();
        string AssemblyName = p.ProcessName + ".exe";
        Assembly ThisAssembly = Assembly.LoadFrom(AssemblyName);
        Console.WriteLine("DllTestClient.exe Assembly Information"); 
        Console.WriteLine("	" + ThisAssembly + "
");

  Console.WriteLine("Calling DllTestServer.Foo...");
  DllTestServer.Foo();
    }
}

           
          


Load system dll library

   


using System;
using System.Reflection;

class Class1 {
   static void Main(string[] args) {
      string windir = Environment.GetEnvironmentVariable("windir");
      Assembly ass = Assembly.LoadFrom(windir + @"Microsoft.NETFrameworkv1.1.4322System.Drawing.dll");
      foreach (Type type in ass.GetTypes()) {
         Console.WriteLine(type.ToString());
      }
   }
}