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.

130 lines
3.7 KiB

  1. // filedlg.h : header file
  2. //
  3. // Copyright (C) 1992-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // This file is to support an extended file save dialog with a
  7. // "Use this format by default" checkbox
  8. //
  9. // The shell guys insist that Wordpad call GetOpenFileName with the newest
  10. // OPENFILENAME structure but MFC doesn't support it. MFC also needs to be
  11. // built with _WIN32_WINNT set to 0x0400 so Wordpad can't even see the new
  12. // structure. Since the shell guys won't change the way they define the
  13. // structure so that Wordpad can see both versions, it has to be snapshotted
  14. // here.
  15. //
  16. #if !defined(_WIN64)
  17. #include <pshpack1.h> // Must byte pack to match definition in commdlg.h
  18. #endif
  19. typedef struct tagOFN500A {
  20. DWORD lStructSize;
  21. HWND hwndOwner;
  22. HINSTANCE hInstance;
  23. LPCSTR lpstrFilter;
  24. LPSTR lpstrCustomFilter;
  25. DWORD nMaxCustFilter;
  26. DWORD nFilterIndex;
  27. LPSTR lpstrFile;
  28. DWORD nMaxFile;
  29. LPSTR lpstrFileTitle;
  30. DWORD nMaxFileTitle;
  31. LPCSTR lpstrInitialDir;
  32. LPCSTR lpstrTitle;
  33. DWORD Flags;
  34. WORD nFileOffset;
  35. WORD nFileExtension;
  36. LPCSTR lpstrDefExt;
  37. LPARAM lCustData;
  38. LPOFNHOOKPROC lpfnHook;
  39. LPCSTR lpTemplateName;
  40. struct IMoniker **rgpMonikers;
  41. DWORD cMonikers;
  42. DWORD FlagsEx;
  43. } OPENFILENAME500A, *LPOPENFILENAME500A;
  44. typedef struct tagOFN500W {
  45. DWORD lStructSize;
  46. HWND hwndOwner;
  47. HINSTANCE hInstance;
  48. LPCWSTR lpstrFilter;
  49. LPWSTR lpstrCustomFilter;
  50. DWORD nMaxCustFilter;
  51. DWORD nFilterIndex;
  52. LPWSTR lpstrFile;
  53. DWORD nMaxFile;
  54. LPWSTR lpstrFileTitle;
  55. DWORD nMaxFileTitle;
  56. LPCWSTR lpstrInitialDir;
  57. LPCWSTR lpstrTitle;
  58. DWORD Flags;
  59. WORD nFileOffset;
  60. WORD nFileExtension;
  61. LPCWSTR lpstrDefExt;
  62. LPARAM lCustData;
  63. LPOFNHOOKPROC lpfnHook;
  64. LPCWSTR lpTemplateName;
  65. struct IMoniker **rgpMonikers;
  66. DWORD cMonikers;
  67. DWORD FlagsEx;
  68. } OPENFILENAME500W, *LPOPENFILENAME500W;
  69. #ifdef UNICODE
  70. typedef OPENFILENAME500W OPENFILENAME500;
  71. typedef LPOPENFILENAME500W LPOPENFILENAME500;
  72. #else
  73. typedef OPENFILENAME500A OPENFILENAME500;
  74. typedef LPOPENFILENAME500A LPOPENFILENAME500;
  75. #endif // UNICODE
  76. #if !defined(_WIN64)
  77. #include <poppack.h>
  78. #endif
  79. class CWordpadFileDialog : public CFileDialog
  80. {
  81. DECLARE_DYNAMIC(CWordpadFileDialog);
  82. public:
  83. CWordpadFileDialog(BOOL bOpenFileDialog);
  84. int GetFileType() {return m_doctype;}
  85. static void SetDefaultFileType(int doctype)
  86. {
  87. m_defaultDoctype = doctype;
  88. RD_DEFAULT = doctype;
  89. }
  90. static int GetDefaultFileType() {return m_defaultDoctype;}
  91. virtual INT_PTR DoModal();
  92. protected:
  93. int m_doctype;
  94. static int m_defaultDoctype;
  95. LPOFNHOOKPROC m_original_hook;
  96. OPENFILENAME500 m_openfilename;
  97. static const DWORD m_nHelpIDs[];
  98. virtual const DWORD* GetHelpIDs() {return m_nHelpIDs;}
  99. static UINT_PTR CALLBACK FileDialogHookProc(HWND, UINT, WPARAM, LPARAM);
  100. virtual BOOL OnFileNameOK();
  101. virtual void OnTypeChange();
  102. virtual void OnInitDone();
  103. // Generated message map functions
  104. //{{AFX_MSG(CWordpadFileDialog)
  105. afx_msg void OnDefaultFormatClicked();
  106. //}}AFX_MSG
  107. afx_msg LONG OnHelp(WPARAM wParam, LPARAM lParam);
  108. afx_msg LONG OnHelpContextMenu(WPARAM wParam, LPARAM lParam);
  109. DECLARE_MESSAGE_MAP()
  110. };