title: Why the current working directory changes when use the Open file dialog in Windows XP?
body: <p>I have found an strange behavior when use the open file dialog in c#. </p>
  
  <p>If use this code in <code>Windows XP</code> the current working directory changes to the path of the selected file, however if you run this code in <code>Windows 7</code> the current working directory does not change.</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {            
          MessageBox.Show(string.Format("Current Directory {0}",Directory.GetCurrentDirectory()), "My Application",MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
          DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog and get result.
          if (result == DialogResult.OK) 
          {
  
          }
          MessageBox.Show(string.Format("Current Directory {0}", Directory.GetCurrentDirectory()), "My Application", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
      }
  </code></pre>
  
  <p>Anybody know the reason for this behavior? Why the current directory changes in XP and not in <code>Windows 7</code>?</p>