title: GetSaveFileName() how to update the file extension in the "File name:" control?
body: <p>I have the following code (extract) to display Save As dialog:</p>
  
  <pre><code>char FileName[MAX_PATH] = "TestImage.jpg"
  
  ...
  
  lpofn.lStructSize = sizeof(OPENFILENAME);
  lpofn.hwndOwner = hWnd;
  lpofn.hInstance = GetWindowInstance (hWnd);
  lpofn.lpstrFilter = "JPG - JPEG File\0*.JPG\0TIF - TIFF File\0*.TIF\0PNG File\0*.PNG\0BMP - Bitmat File\0*.BMP\0";
  lpofn.lpstrCustomFilter = NULL;
  lpofn.nMaxCustFilter = NULL;
  lpofn.nFilterIndex = 0;
  lpofn.lpstrFile = FileName;
  lpofn.nMaxFile = MAX_PATH;
  lpofn.lpstrFileTitle = NULL;
  lpofn.nMaxFileTitle = NULL;
  lpofn.lpstrInitialDir = NULL;
  lpofn.lpstrTitle = NULL;
  lpofn.Flags = OFN_HIDEREADONLY | OFN_ENABLEHOOK | OFN_EXPLORER;
  lpofn.nFileOffset = 0;
  lpofn.nFileExtension = 0;
  lpofn.lpstrDefExt = NULL;
  lpofn.lCustData = NULL;
  lpofn.lpfnHook = &amp;UpdateFilename;
  lpofn.lpTemplateName = NULL;
  if(!GetSaveFileName(&amp;lpofn)) return;
  
  ...
  </code></pre>
  
  <p>eg. 
  - User does save as, default File name = "TestImage.jpg", default Files of Type = JPG
  - User changes Files of Type to PNG, File name control remains at "TestImage.jpg" instead of changing to "TestImage.png"</p>
  
  <p>Am I doing something wrong?  Is it possible to instruct GetSaveFileName() to change the extension, or do I have to have a custom save as dialog (any examples?)</p>
  
  <p>I'm using Win32 API, VC6.</p>
  
  <p><strong>Update:</strong> here is the Hook function:  </p>
  
  <pre><code>UINT CALLBACK UpdateFilename(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
  {
      switch (uiMsg)
      {
           case WM_NOTIFY:
            // Check for CDN_TYPECHANGE etc
                return FALSE;
      }
  
      return FALSE;
  }
  </code></pre>
  
  <p>Note that the hook function does stop on breakpoints.  I've purposely not proceeded further with handling CDN_TYPECHANGE until I can figure out why the look of the dialog changes when the hook is enabled and how to fix it.</p>