Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.1 KiB

  1. /****************************************************************************\
  2. *
  3. * custfile.cpp
  4. *
  5. * Created: William Taylor (wtaylor) 01/22/01
  6. *
  7. * MS Ratings Custom File Dialog
  8. *
  9. \****************************************************************************/
  10. #include "msrating.h"
  11. #include "mslubase.h"
  12. #include "custfile.h" // CCustomFileDialog
  13. #include <atlmisc.h> // CString
  14. // The reason this file is not currently added is the Ansi version of GetOpenFileName()
  15. // currently displays the Old version of the Open File Dialog when a Hook is required.
  16. // If the msrating.dll is converted to Unicode, the CCustomFileDialog should be included
  17. // and should properly display the New version of the Open File Dialog.
  18. // If this file is added to the Build the following needs to be added as a Resource:
  19. // IDS_LOCAL_FILE_REQUIRED "The file selected must be a local file for correct Content Advisor functionality.\r\n\r\n%s"
  20. LRESULT CCustomFileDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  21. {
  22. bHandled = FALSE;
  23. return 1L;
  24. }
  25. // Insures the File is a Local File
  26. LRESULT CCustomFileDialog::OnFileOk(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled)
  27. {
  28. if ( m_bLocalFileCheck )
  29. {
  30. CString strFile( m_szFileName );
  31. CString strDrive = strFile.Left( 3 );
  32. UINT uiDriveType;
  33. uiDriveType = ::GetDriveType( strDrive );
  34. if ( uiDriveType != DRIVE_FIXED )
  35. {
  36. CString strMessage;
  37. strMessage.Format( IDS_LOCAL_FILE_REQUIRED, strFile );
  38. MyMessageBox( m_hWnd, strMessage, IDS_GENERIC, MB_OK | MB_ICONWARNING );
  39. return -1;
  40. }
  41. }
  42. bHandled = FALSE;
  43. return 0L;
  44. }
  45. // Insures if Open File Flags are changed the Dialog will be Properly Derived
  46. int CCustomFileDialog::DoModal(HWND hWndParent)
  47. {
  48. m_ofn.Flags |= OFN_ENABLEHOOK | OFN_EXPLORER; // Please don't remove these flags
  49. return CFileDialog::DoModal(hWndParent);
  50. }