title: C++ WinAPI error when GetOpenFileName
body: <p>Good day. I made a class to work OpenFileDialog:</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  
  enum DialogResult { OK, Cancel };
  
  class IFileDialog
  {
  public: 
      TCHAR FileName[MAX_PATH];
      LPTSTR Title;
      virtual DialogResult Show() = 0;
  };
  
  class COpenFileDialog  : public IFileDialog
  {
  public:
      LPTSTR Filter;
      LPTSTR DefExt;
      COpenFileDialog(HWND hWnd);
      DialogResult Show();
  private:
      OPENFILENAME m_ofn;
  };
  
  COpenFileDialog::COpenFileDialog(HWND hWnd)
  {
      //FileName[0] = '\0';
  
      ZeroMemory(&amp;m_ofn, sizeof(m_ofn));
  
      m_ofn.lStructSize = sizeof(m_ofn);
      m_ofn.hwndOwner = hWnd;
      m_ofn.lpstrFilter = Filter;
      m_ofn.nMaxFile = MAX_PATH;
      m_ofn.lpstrFile = FileName;
      m_ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
      m_ofn.lpstrDefExt = DefExt;
  }
  
  DialogResult COpenFileDialog::Show()
  {
      return GetOpenFileName(&amp;m_ofn) ? DialogResult::OK : DialogResult::Cancel;
  }
  </code></pre>
  
  <p>Calling:</p>
  
  <pre><code>COpenFileDialog hDialog = COpenFileDialog(hMainWindow);
  hDialog.Filter = "M&amp;B Scenes\0*.sco\0";
  hDialog.DefExt = "sco";
  hDialog.Title = "";
  
  if(hDialog.Show() == DialogResult::OK)
  {
      //TODO
  }
  </code></pre>
  
  <p>But the program crushes on hDialog.Show(), but rather a call GetOpenFileName(&amp;m_ofn):Unhandled exception at 0x000007FDFC5D21A3 (SHCore.dll) in ScoEditor.exe: 0xC0000005: Access violation reading location 0x000000E600000000.</p>
  
  <p>How can I fix it?</p>