<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9037818310497811090</id><updated>2012-02-16T13:13:25.733-08:00</updated><title type='text'>System Programing In Csharp</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-1827675500968563696</id><published>2009-05-30T22:19:00.003-07:00</published><updated>2009-05-30T22:19:59.339-07:00</updated><title type='text'>Retrieve the path to the Windows System directory</title><content type='html'>/*&lt;br /&gt;  Retrieve the path to the Windows System directory&lt;br /&gt;  -&lt;br /&gt;  ex. C:\Windows\System32\&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;string winDir = Environment.GetFolderPath(Environment.SpecialFolder.System)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-1827675500968563696?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/1827675500968563696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/retrieve-path-to-windows-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/1827675500968563696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/1827675500968563696'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/retrieve-path-to-windows-system.html' title='Retrieve the path to the Windows System directory'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-5216667232734192326</id><published>2009-05-30T22:19:00.001-07:00</published><updated>2009-05-30T22:19:36.957-07:00</updated><title type='text'>Display information about all of the drives on the current system</title><content type='html'>/*&lt;br /&gt;  The following code example demonstrates the use of the DriveInfo&lt;br /&gt;  class to display information about all of the drives on the current system.&lt;br /&gt;  -&lt;br /&gt;  This code produces output similar to the following:&lt;br /&gt;&lt;br /&gt;Drive A:\&lt;br /&gt;  File type: Removable&lt;br /&gt;Drive C:\&lt;br /&gt;  File type: Fixed&lt;br /&gt;  Volume label:&lt;br /&gt;  File system: FAT32&lt;br /&gt;  Available space to current user:     4770430976 bytes&lt;br /&gt;  Total available space:               4770430976 bytes&lt;br /&gt;  Total size of drive:                10731683840 bytes&lt;br /&gt;Drive D:\&lt;br /&gt;  File type: Fixed&lt;br /&gt;  Volume label:&lt;br /&gt;  File system: NTFS&lt;br /&gt;  Available space to current user:    15114977280 bytes&lt;br /&gt;  Total available space:              15114977280 bytes&lt;br /&gt;  Total size of drive:                25958948864 bytes&lt;br /&gt;Drive E:\&lt;br /&gt;  File type: CDRom&lt;br /&gt;&lt;br /&gt;The actual output of this code will vary based on machine and the permissions&lt;br /&gt;granted to the user executing it.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;class Test&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        DriveInfo[] allDrives = DriveInfo.GetDrives();&lt;br /&gt;&lt;br /&gt;        foreach (DriveInfo d in allDrives)&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("Drive {0}", d.Name);&lt;br /&gt;            Console.WriteLine("  File type: {0}", d.DriveType);&lt;br /&gt;            if (d.IsReady == true)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine("  Volume label: {0}", d.VolumeLabel);&lt;br /&gt;                Console.WriteLine("  File system: {0}", d.DriveFormat);&lt;br /&gt;                Console.WriteLine(&lt;br /&gt;                    "  Available space to current user:{0, 15} bytes",&lt;br /&gt;                    d.AvailableFreeSpace);&lt;br /&gt;&lt;br /&gt;                Console.WriteLine(&lt;br /&gt;                    "  Total available space:          {0, 15} bytes",&lt;br /&gt;                    d.TotalFreeSpace);&lt;br /&gt;&lt;br /&gt;                Console.WriteLine(&lt;br /&gt;                    "  Total size of drive:            {0, 15} bytes ",&lt;br /&gt;                    d.TotalSize);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-5216667232734192326?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/5216667232734192326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/display-information-about-all-of-drives.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/5216667232734192326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/5216667232734192326'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/display-information-about-all-of-drives.html' title='Display information about all of the drives on the current system'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-2611157465439705509</id><published>2009-05-30T22:18:00.000-07:00</published><updated>2009-05-30T22:19:04.716-07:00</updated><title type='text'>Detect Windows Clipboard Change</title><content type='html'>//  Detect Windows Clipboard Change&lt;br /&gt;&lt;br /&gt;  // ...&lt;br /&gt;&lt;br /&gt;  [DllImport("user32.dll")]&lt;br /&gt;  public static extern int SetClipboardViewer(int hwnd);&lt;br /&gt;&lt;br /&gt;  public Form1() {&lt;br /&gt;    InitializeComponent();&lt;br /&gt;    SetClipboardViewer(this.Handle.ToInt32());&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  protected override void WndProc(ref Message m) {&lt;br /&gt;    base.WndProc(ref m);&lt;br /&gt;&lt;br /&gt;    // chkClipboard isn't checked initially&lt;br /&gt;    // so this prevents MessageBox on Form load:&lt;br /&gt;&lt;br /&gt;    if (m.Msg == 776 &amp;&amp; chkClipboard.Checked)&lt;br /&gt;    {&lt;br /&gt;        // Clipboard change!&lt;br /&gt;    }&lt;br /&gt;  }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-2611157465439705509?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/2611157465439705509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/detect-windows-clipboard-change.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2611157465439705509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2611157465439705509'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/detect-windows-clipboard-change.html' title='Detect Windows Clipboard Change'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-2873718123344300639</id><published>2009-05-30T22:17:00.006-07:00</published><updated>2009-05-30T22:18:08.056-07:00</updated><title type='text'>Displaying HTML Help Files</title><content type='html'>using System;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.ComponentModel;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;using System.Data;&lt;br /&gt;&lt;br /&gt;namespace DevDistrict&lt;br /&gt;{&lt;br /&gt;        ///&lt;br /&gt;        /// Summary description for Form1.&lt;br /&gt;        ///&lt;br /&gt;        public class Form1 : System.Windows.Forms.Form&lt;br /&gt;        {&lt;br /&gt;                private System.Windows.Forms.HelpProvider helpProvider1;&lt;br /&gt;                private System.Windows.Forms.Button btnShowContents;&lt;br /&gt;                private System.Windows.Forms.Button btnShowIndex;&lt;br /&gt;                private System.Windows.Forms.Button btnSearchHelp;&lt;br /&gt;&lt;br /&gt;                private System.ComponentModel.Container components = null;&lt;br /&gt;&lt;br /&gt;                public Form1()&lt;br /&gt;                {&lt;br /&gt;                        InitializeComponent();&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                private void btnShowContents_Click(object sender, System.EventArgs e)&lt;br /&gt;                {&lt;br /&gt;                        Help.ShowHelp(this, helpProvider1.HelpNamespace);&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                private void btnShowIndex_Click(object sender, System.EventArgs e)&lt;br /&gt;                {&lt;br /&gt;                        Help.ShowHelpIndex(this, helpProvider1.HelpNamespace);&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                private void btnSearchHelp_Click(object sender, System.EventArgs e)&lt;br /&gt;                {&lt;br /&gt;                        Help.ShowHelp(this, helpProvider1.HelpNamespace, HelpNavigator.Find, "");&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                #region Windows Form Designer generated code&lt;br /&gt;                ///&lt;br /&gt;                /// Required method for Designer support - do not modify&lt;br /&gt;                /// the contents of this method with the code editor.&lt;br /&gt;                ///&lt;br /&gt;                private void InitializeComponent()&lt;br /&gt;                {&lt;br /&gt;                        this.helpProvider1 = new System.Windows.Forms.HelpProvider();&lt;br /&gt;                        this.btnShowContents = new System.Windows.Forms.Button();&lt;br /&gt;                        this.btnShowIndex = new System.Windows.Forms.Button();&lt;br /&gt;                        this.btnSearchHelp = new System.Windows.Forms.Button();&lt;br /&gt;                        this.SuspendLayout();&lt;br /&gt;                        //&lt;br /&gt;                        // helpProvider1&lt;br /&gt;                        //&lt;br /&gt;                        this.helpProvider1.HelpNamespace = "C:\\dev\\WindowsApplication40\\htmlhelp.chm";&lt;br /&gt;                        //&lt;br /&gt;                        // btnShowContents&lt;br /&gt;                        //&lt;br /&gt;                        this.btnShowContents.Location = new System.Drawing.Point(8, 8);&lt;br /&gt;                        this.btnShowContents.Name = "btnShowContents";&lt;br /&gt;                        this.btnShowContents.Size = new System.Drawing.Size(96, 23);&lt;br /&gt;                        this.btnShowContents.TabIndex = 0;&lt;br /&gt;                        this.btnShowContents.Text = "Show Contents";&lt;br /&gt;                        this.btnShowContents.Click += new System.EventHandler(this.btnShowContents_Click);&lt;br /&gt;                        //&lt;br /&gt;                        // btnShowIndex&lt;br /&gt;                        //&lt;br /&gt;                        this.btnShowIndex.Location = new System.Drawing.Point(8, 48);&lt;br /&gt;                        this.btnShowIndex.Name = "btnShowIndex";&lt;br /&gt;                        this.btnShowIndex.Size = new System.Drawing.Size(96, 23);&lt;br /&gt;                        this.btnShowIndex.TabIndex = 1;&lt;br /&gt;                        this.btnShowIndex.Text = "Show Index";&lt;br /&gt;                        this.btnShowIndex.Click += new System.EventHandler(this.btnShowIndex_Click);&lt;br /&gt;                        //&lt;br /&gt;                        // btnSearchHelp&lt;br /&gt;                        //&lt;br /&gt;                        this.btnSearchHelp.Location = new System.Drawing.Point(8, 88);&lt;br /&gt;                        this.btnSearchHelp.Name = "btnSearchHelp";&lt;br /&gt;                        this.btnSearchHelp.Size = new System.Drawing.Size(96, 23);&lt;br /&gt;                        this.btnSearchHelp.TabIndex = 2;&lt;br /&gt;                        this.btnSearchHelp.Text = "Search Help";&lt;br /&gt;                        this.btnSearchHelp.Click += new System.EventHandler(this.btnSearchHelp_Click);&lt;br /&gt;                        //&lt;br /&gt;                        // Form1&lt;br /&gt;                        //&lt;br /&gt;                        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;                        this.ClientSize = new System.Drawing.Size(200, 174);&lt;br /&gt;                        this.Controls.Add(this.btnSearchHelp);&lt;br /&gt;                        this.Controls.Add(this.btnShowIndex);&lt;br /&gt;                        this.Controls.Add(this.btnShowContents);&lt;br /&gt;                        this.Name = "Form1";&lt;br /&gt;                        this.Text = "Form1";&lt;br /&gt;                        this.ResumeLayout(false);&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;                #endregion&lt;br /&gt;&lt;br /&gt;                ///&lt;br /&gt;                /// The main entry point for the application.&lt;br /&gt;                ///&lt;br /&gt;                [STAThread]&lt;br /&gt;                static void Main()&lt;br /&gt;                {&lt;br /&gt;                        Application.Run(new Form1());&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                protected override void Dispose( bool disposing )&lt;br /&gt;                {&lt;br /&gt;                        if( disposing )&lt;br /&gt;                        {&lt;br /&gt;                                if (components != null)&lt;br /&gt;                                {&lt;br /&gt;                                        components.Dispose();&lt;br /&gt;                                }&lt;br /&gt;                        }&lt;br /&gt;                        base.Dispose( disposing );&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-2873718123344300639?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/2873718123344300639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/displaying-html-help-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2873718123344300639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2873718123344300639'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/displaying-html-help-files.html' title='Displaying HTML Help Files'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-2099898874560027526</id><published>2009-05-30T22:17:00.005-07:00</published><updated>2009-05-30T22:17:47.746-07:00</updated><title type='text'>Get OS version</title><content type='html'>// Get OS version&lt;br /&gt;&lt;br /&gt; public static string GetMachineOS()&lt;br /&gt; {&lt;br /&gt;  if (Environment.OSVersion.Platform == PlatformID.Win32NT)&lt;br /&gt;  {&lt;br /&gt;   if (Environment.OSVersion.Version.Major&lt;=4)&lt;br /&gt;    return String.Format("Windows NT {0}", Environment.OSVersion.Version.ToString());&lt;br /&gt;   if (Environment.OSVersion.Version.Major==5)&lt;br /&gt;   {&lt;br /&gt;    if (Environment.OSVersion.Version.Minor==0)&lt;br /&gt;     return String.Format("Windows 2000 {0}", Environment.OSVersion.Version.ToString());&lt;br /&gt;    else&lt;br /&gt;     return String.Format("Windows XP {0}", Environment.OSVersion.Version.ToString());&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  if (Environment.OSVersion.Platform == PlatformID.Win32Windows)&lt;br /&gt;  {&lt;br /&gt;   if (Environment.OSVersion.Version.Major&gt;=4)&lt;br /&gt;   {&lt;br /&gt;    if (Environment.OSVersion.Version.Minor==0)&lt;br /&gt;     return String.Format("Windows 95 {0}", Environment.OSVersion.Version.ToString());&lt;br /&gt;    else if (Environment.OSVersion.Version.Minor&lt;90)&lt;br /&gt;     return String.Format("Windows 98 {0}", Environment.OSVersion.Version.ToString());&lt;br /&gt;    else&lt;br /&gt;     return String.Format("Windows Millenim Edition {0}", Environment.OSVersion.Version.ToString());&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  return Environment.OSVersion.ToString(); //ELSE&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-2099898874560027526?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/2099898874560027526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/get-os-version.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2099898874560027526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2099898874560027526'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/get-os-version.html' title='Get OS version'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-4000844228096497750</id><published>2009-05-30T22:17:00.003-07:00</published><updated>2009-05-30T22:17:32.079-07:00</updated><title type='text'>Get list of running processes</title><content type='html'>// Get list of running processes&lt;br /&gt;&lt;br /&gt;Console.WriteLine("ID:\tProcess name:");&lt;br /&gt;Console.WriteLine("--\t------------");&lt;br /&gt;foreach (System.Diagnostics.Process process in System.Diagnostics.Process.GetProcesses())&lt;br /&gt;         Console.WriteLine("{0}\t{1}", process.Id, process.ProcessName);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-4000844228096497750?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/4000844228096497750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/get-list-of-running-processes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/4000844228096497750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/4000844228096497750'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/get-list-of-running-processes.html' title='Get list of running processes'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-2578086169911589231</id><published>2009-05-30T22:17:00.001-07:00</published><updated>2009-05-30T22:17:16.083-07:00</updated><title type='text'>How to Monitor a Process</title><content type='html'>using System;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;&lt;br /&gt;namespace DevDistrict.MachineMonitor&lt;br /&gt;{&lt;br /&gt;        public class Monitor&lt;br /&gt;        {&lt;br /&gt;                [STAThread()]&lt;br /&gt;                public static void Main()&lt;br /&gt;                {&lt;br /&gt;                        System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("Notepad");&lt;br /&gt;&lt;br /&gt;                        if (p.Length&lt;0)&lt;br /&gt;                        {&lt;br /&gt;                                Console.WriteLine("No process");&lt;br /&gt;                                return;&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        if (p[0].HasExited)&lt;br /&gt;                        {&lt;br /&gt;                                Console.WriteLine("Process Exited");&lt;br /&gt;                                return;&lt;br /&gt;                        }&lt;br /&gt;&lt;br /&gt;                        p[0].Exited+=new EventHandler(Startup_Exited);&lt;br /&gt;&lt;br /&gt;                        while(!p[0].HasExited)&lt;br /&gt;                        {&lt;br /&gt;                                p[0].WaitForExit(30000);&lt;br /&gt;&lt;br /&gt;                                Console.WriteLine("checking process health");&lt;br /&gt;                        }&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                private static void Startup_Exited(object sender, EventArgs e)&lt;br /&gt;                {&lt;br /&gt;                        Console.WriteLine("PROCESS EXIT CAUGHT");&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-2578086169911589231?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/2578086169911589231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/how-to-monitor-process.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2578086169911589231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2578086169911589231'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/how-to-monitor-process.html' title='How to Monitor a Process'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-2149538903062738204</id><published>2009-05-30T22:16:00.003-07:00</published><updated>2009-05-30T22:16:59.551-07:00</updated><title type='text'>OnApplicationExit event</title><content type='html'>// OnApplicationExit event&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Threading;&lt;br /&gt;using System.Reflection;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class HelloWorldForm : Form&lt;br /&gt;{&lt;br /&gt;    public HelloWorldForm()&lt;br /&gt;    {&lt;br /&gt;        Text = "Hello, WindowsForms!";&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ApplicationEventHandlerClass&lt;br /&gt;{&lt;br /&gt;    public void OnApplicationExit(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("The application is shutting down.");&lt;br /&gt;        }&lt;br /&gt;        catch(NotSupportedException)&lt;br /&gt;        {&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class MainClass&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        HelloWorldForm FormObject = new HelloWorldForm();&lt;br /&gt;        ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();&lt;br /&gt;&lt;br /&gt;        Application.ApplicationExit += new EventHandler(AppEvents.OnApplicationExit);&lt;br /&gt;        Application.Run(FormObject);&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-2149538903062738204?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/2149538903062738204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/onapplicationexit-event.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2149538903062738204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/2149538903062738204'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/onapplicationexit-event.html' title='OnApplicationExit event'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9037818310497811090.post-8823940526562637863</id><published>2009-05-30T22:16:00.001-07:00</published><updated>2009-05-30T22:16:37.596-07:00</updated><title type='text'>OnApplicationIdle event</title><content type='html'>// OnApplicationIdle event&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Threading;&lt;br /&gt;using System.Reflection;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class HelloWorldForm : Form&lt;br /&gt;{&lt;br /&gt;    public HelloWorldForm()&lt;br /&gt;    {&lt;br /&gt;        Text = "Hello, WindowsForms!";&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ApplicationEventHandlerClass&lt;br /&gt;{&lt;br /&gt;    public void OnIdle(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine("The application is idle.");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class MainClass&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        HelloWorldForm FormObject = new HelloWorldForm();&lt;br /&gt;        ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();&lt;br /&gt;&lt;br /&gt;        Application.Idle += new EventHandler(AppEvents.OnIdle);&lt;br /&gt;        Application.Run(FormObject);&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9037818310497811090-8823940526562637863?l=systemincsharp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://systemincsharp.blogspot.com/feeds/8823940526562637863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/onapplicationidle-event.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/8823940526562637863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9037818310497811090/posts/default/8823940526562637863'/><link rel='alternate' type='text/html' href='http://systemincsharp.blogspot.com/2009/05/onapplicationidle-event.html' title='OnApplicationIdle event'/><author><name>Avinash Tiwari</name><uri>http://www.blogger.com/profile/15802356010881135678</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_LGmdihF6s00/SbOiiR5usKI/AAAAAAAAACo/AetFd4M1LfU/S220/UploadedImage.jpg'/></author><thr:total>0</thr:total></entry></feed>
