Source code of Windows XP (NT5)
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.

166 lines
5.4 KiB

  1. /*
  2. * COMMON.H
  3. *
  4. * Structures and definitions applicable to all OLE 2.0 UI dialogs.
  5. *
  6. * Copyright (c)1992 Microsoft Corporation, All Right Reserved
  7. */
  8. #ifndef _COMMON_H_
  9. #define _COMMON_H_
  10. //Macros to handle control message packing between Win16 and Win32
  11. #ifdef WIN32
  12. #ifndef COMMANDPARAMS
  13. #define COMMANDPARAMS(wID, wCode, hWndMsg) \
  14. WORD wID = LOWORD(wParam); \
  15. WORD wCode = HIWORD(wParam); \
  16. HWND hWndMsg = (HWND)(UINT)lParam;
  17. #endif //COMMANDPARAMS
  18. #ifndef SendCommand
  19. #define SendCommand(hWnd, wID, wCode, hControl) \
  20. SendMessage(hWnd, WM_COMMAND, MAKELONG(wID, wCode) \
  21. , (LPARAM)hControl)
  22. #endif //SendCommand
  23. #else //Start !WIN32
  24. #ifndef COMMANDPARAMS
  25. #define COMMANDPARAMS(wID, wCode, hWndMsg) \
  26. WORD wID = LOWORD(wParam); \
  27. WORD wCode = HIWORD(lParam); \
  28. HWND hWndMsg = (HWND)(UINT)lParam;
  29. #endif //COMMANDPARAMS
  30. #ifndef SendCommand
  31. #define SendCommand(hWnd, wID, wCode, hControl) \
  32. SendMessage(hWnd, WM_COMMAND, wID \
  33. , MAKELONG(hControl, wCode))
  34. #endif //SendCommand
  35. #endif //!WIN32
  36. //Property labels used to store dialog structures and fonts
  37. #define STRUCTUREPROP TEXT("Structure")
  38. #define FONTPROP TEXT("Font")
  39. /*
  40. * Standard structure for all dialogs. This commonality lets us make
  41. * a single piece of code that will validate this entire structure and
  42. * perform any necessary initialization.
  43. */
  44. typedef struct tagOLEUISTANDARD
  45. {
  46. //These IN fields are standard across all OLEUI dialog functions.
  47. DWORD cbStruct; //Structure Size
  48. DWORD dwFlags; //IN-OUT: Flags
  49. HWND hWndOwner; //Owning window
  50. LPCTSTR lpszCaption; //Dialog caption bar contents
  51. LPFNOLEUIHOOK lpfnHook; //Hook callback
  52. LPARAM lCustData; //Custom data to pass to hook
  53. HINSTANCE hInstance; //Instance for customized template name
  54. LPCTSTR lpszTemplate; //Customized template name
  55. HRSRC hResource; //Customized template handle
  56. } OLEUISTANDARD, *POLEUISTANDARD, FAR *LPOLEUISTANDARD;
  57. //Function prototypes
  58. //COMMON.C
  59. UINT WINAPI UStandardValidation(const LPOLEUISTANDARD, const UINT, const HGLOBAL FAR *);
  60. #ifdef WIN32
  61. UINT WINAPI UStandardInvocation(DLGPROC, LPOLEUISTANDARD, HGLOBAL, LPTSTR);
  62. #else
  63. UINT WINAPI UStandardInvocation(DLGPROC, LPOLEUISTANDARD, HGLOBAL, LPCTSTR);
  64. #endif
  65. LPVOID WINAPI LpvStandardInit(HWND, UINT, BOOL, HFONT FAR *);
  66. LPVOID WINAPI LpvStandardEntry(HWND, UINT, WPARAM, LPARAM, UINT FAR *);
  67. UINT WINAPI UStandardHook(LPVOID, HWND, UINT, WPARAM, LPARAM);
  68. void WINAPI StandardCleanup(LPVOID, HWND);
  69. void WINAPI StandardShowDlgItem(HWND hDlg, int idControl, int nCmdShow);
  70. //DRAWICON.C
  71. //Structure for label and source extraction from a metafile
  72. typedef struct tagLABELEXTRACT
  73. {
  74. LPTSTR lpsz;
  75. UINT Index; // index in lpsz (so we can retrieve 2+ lines)
  76. DWORD PrevIndex; // index of last line (so we can mimic word wrap)
  77. union
  78. {
  79. UINT cch; //Length of label for label extraction
  80. UINT iIcon; //Index of icon in source extraction.
  81. } u;
  82. //For internal use in enum procs
  83. BOOL fFoundIconOnly;
  84. BOOL fFoundSource;
  85. BOOL fFoundIndex;
  86. } LABELEXTRACT, FAR * LPLABELEXTRACT;
  87. //Structure for extracting icons from a metafile (CreateIcon parameters)
  88. typedef struct tagICONEXTRACT
  89. {
  90. HICON hIcon; //Icon created in the enumeration proc.
  91. /*
  92. * Since we want to handle multitasking well we have the caller
  93. * of the enumeration proc instantiate these variables instead of
  94. * using statics in the enum proc (which would be bad).
  95. */
  96. BOOL fAND;
  97. HGLOBAL hMemAND; //Enumeration proc allocates and copies
  98. } ICONEXTRACT, FAR * LPICONEXTRACT;
  99. //Structure to use to pass info to EnumMetafileDraw
  100. typedef struct tagDRAWINFO
  101. {
  102. RECT Rect;
  103. BOOL fIconOnly;
  104. } DRAWINFO, FAR * LPDRAWINFO;
  105. int CALLBACK EXPORT EnumMetafileIconDraw(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPARAM);
  106. int CALLBACK EXPORT EnumMetafileExtractLabel(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  107. int CALLBACK EXPORT EnumMetafileExtractIcon(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPICONEXTRACT);
  108. int CALLBACK EXPORT EnumMetafileExtractIconSource(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  109. //Shared globals: our instance, registered messages used from all dialogs and clipboard
  110. // formats used by the PasteSpecial dialog
  111. extern HINSTANCE ghInst;
  112. extern UINT uMsgHelp;
  113. extern UINT uMsgEndDialog;
  114. extern UINT uMsgBrowse;
  115. extern UINT uMsgChangeIcon;
  116. extern UINT uMsgFileOKString;
  117. extern UINT uMsgCloseBusyDlg;
  118. extern UINT cfObjectDescriptor;
  119. extern UINT cfLinkSrcDescriptor;
  120. extern UINT cfEmbedSource;
  121. extern UINT cfEmbeddedObject;
  122. extern UINT cfLinkSource;
  123. extern UINT cfOwnerLink;
  124. extern UINT cfFileName;
  125. //Standard control identifiers
  126. #define ID_NULL 98
  127. #endif //_COMMON_H_
  128.