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.

958 lines
37 KiB

  1. /*
  2. * OLE2UI.H
  3. *
  4. * Published definitions, structures, types, and function prototypes for the
  5. * OLE 2.0 User Interface support library.
  6. *
  7. * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  8. */
  9. #ifndef _OLE2UI_H_
  10. #define _OLE2UI_H_
  11. #undef UNICODE
  12. #undef _UNICODE
  13. #if DBG == 1
  14. // Lazy way to avoid going through all the files and changing to the
  15. // new standard.
  16. #define _DEBUG 1
  17. #endif // DBG == 1
  18. #ifndef RC_INVOKED
  19. #pragma message ("Including OLE2UI.H from " __FILE__)
  20. #endif //RC_INVOKED
  21. // Macro to ensure strings to be UNICODEd in OLE
  22. #ifdef UNICODE
  23. #define OLETEXT(quote) TEXT(quote)
  24. #else
  25. #define OLETEXT(quote) L##quote
  26. #endif
  27. #if !defined(__cplusplus) && !defined( __TURBOC__)
  28. // #define NONAMELESSUNION // use strict ANSI standard (for DVOBJ.H)
  29. #endif
  30. #ifndef INC_OLE2
  31. #define INC_OLE2
  32. #endif
  33. #include <windows.h>
  34. #include <shellapi.h>
  35. #include <ole2.h>
  36. #include <string.h>
  37. #include <dlgs.h> //For fileopen dlg; standard include
  38. #include "olestd.h"
  39. #include <olethunk.h>
  40. #ifdef __TURBOC__
  41. #define _getcwd getcwd
  42. #define _itoa itoa
  43. #define __max max
  44. #define _find_t find_t
  45. #endif // __TURBOC__
  46. #ifdef WIN32
  47. #define _fmemset memset
  48. #define _fmemcpy memcpy
  49. #define _fmemcmp memcmp
  50. #ifdef UNICODE
  51. // UNICODE stuff
  52. #define _fstrcpy wcscpy
  53. #define _fstrlen wcslen
  54. #define _fstrrchr wcschr
  55. #define _fstrtok wcstok
  56. #define _fstrchr wcscpy
  57. #define _fstrcpy wcscpy
  58. // BUGBUG32: isspace function does not seem to work properly
  59. //
  60. // XXXXX
  61. // create a wide character image to match the ANSI isspace
  62. #undef isspace
  63. #undef iswspace
  64. #define iswspace(j) (j==TEXT(' ') || j==TEXT('\t') || j==TEXT('\n'))
  65. #define isspace(j) (j==' ' || j=='\t' || j=='\n')
  66. #else
  67. // Win32 doesn't support the following _fstrxxx functions
  68. #define _fstrcpy strcpy
  69. #define _fstrlen strlen
  70. #define _fstrrchr strrchr
  71. #define _fstrtok strtok
  72. #define _fstrchr strchr
  73. #define _fstrcpy strcpy
  74. #endif // UNICODE
  75. #endif // WIN32
  76. #if !defined( EXPORT )
  77. #ifdef WIN32
  78. #define EXPORT
  79. #else
  80. #define EXPORT __export
  81. #endif // WIN32
  82. #endif // !EXPORT
  83. /*
  84. * Initialization / Uninitialization routines. OleUIInitialize
  85. * must be called prior to using any functions in OLE2UI, and OleUIUnInitialize
  86. * must be called before you app shuts down and when you are done using the
  87. * library.
  88. *
  89. * NOTE: If you are using the DLL version of this library, these functions
  90. * are automatically called in the DLL's LibMain and WEP, so you should
  91. * not call them directly from your application.
  92. */
  93. // Backward compatibility with older library
  94. #define OleUIUninitialize OleUIUnInitialize
  95. STDAPI_(BOOL) OleUIInitialize(HINSTANCE hInstance,
  96. HINSTANCE hPrevInst,
  97. LPTSTR lpszClassIconBox,
  98. LPTSTR lpszClassResImage);
  99. STDAPI_(BOOL) OleUIUninitialize(void);
  100. //Dialog Identifiers as passed in Help messages to identify the source.
  101. #define IDD_INSERTOBJECT 1000
  102. #define IDD_CHANGEICON 1001
  103. #define IDD_CONVERT 1002
  104. #define IDD_PASTESPECIAL 1003
  105. #define IDD_EDITLINKS 1004
  106. #define IDD_FILEOPEN 1005
  107. #define IDD_BUSY 1006
  108. #define IDD_UPDATELINKS 1007
  109. #define IDD_CANNOTUPDATELINK 1008
  110. #define IDD_CHANGESOURCE 1009
  111. #define IDD_INSERTFILEBROWSE 1010
  112. #define IDD_CHANGEICONBROWSE 1011
  113. // The following Dialogs are message dialogs used by OleUIPromptUser API
  114. #define IDD_LINKSOURCEUNAVAILABLE 1020
  115. #define IDD_SERVERNOTREG 1021
  116. #define IDD_LINKTYPECHANGED 1022
  117. #define IDD_SERVERNOTFOUND 1023
  118. #define IDD_OUTOFMEMORY 1024
  119. // Stringtable identifers
  120. #define IDS_OLE2UIUNKNOWN 300
  121. #define IDS_OLE2UILINK 301
  122. #define IDS_OLE2UIOBJECT 302
  123. #define IDS_OLE2UIEDIT 303
  124. #define IDS_OLE2UICONVERT 304
  125. #define IDS_OLE2UIEDITLINKCMD_1VERB 305
  126. #define IDS_OLE2UIEDITOBJECTCMD_1VERB 306
  127. #define IDS_OLE2UIEDITLINKCMD_NVERB 307
  128. #define IDS_OLE2UIEDITOBJECTCMD_NVERB 308
  129. #define IDS_OLE2UIEDITNOOBJCMD 309
  130. // def. icon label (usu. "Document")
  131. #define IDS_DEFICONLABEL 310
  132. #define IDS_OLE2UIPASTELINKEDTYPE 311
  133. #define IDS_FILTERS 64
  134. #define IDS_ICONFILTERS 65
  135. #define IDS_BROWSE 66
  136. //Resource identifiers for bitmaps
  137. #define IDB_RESULTSEGA 10
  138. #define IDB_RESULTSVGA 11
  139. #define IDB_RESULTSHIRESVGA 12
  140. //Missing from windows.h
  141. #ifndef PVOID
  142. typedef VOID *PVOID;
  143. #endif
  144. //Hook type used in all structures.
  145. typedef UINT (CALLBACK *LPFNOLEUIHOOK)(HWND, UINT, WPARAM, LPARAM);
  146. //Strings for registered messages
  147. #define SZOLEUI_MSG_HELP TEXT("OLEUI_MSG_HELP")
  148. #define SZOLEUI_MSG_ENDDIALOG TEXT("OLEUI_MSG_ENDDIALOG")
  149. #define SZOLEUI_MSG_BROWSE TEXT("OLEUI_MSG_BROWSE")
  150. #define SZOLEUI_MSG_CHANGEICON TEXT("OLEUI_MSG_CHANGEICON")
  151. #define SZOLEUI_MSG_CLOSEBUSYDIALOG TEXT("OLEUI_MSG_CLOSEBUSYDIALOG")
  152. #define SZOLEUI_MSG_FILEOKSTRING TEXT("OLEUI_MSG_FILEOKSTRING")
  153. //Standard error definitions
  154. #define OLEUI_FALSE 0
  155. #define OLEUI_SUCCESS 1 //No error, same as OLEUI_OK
  156. #define OLEUI_OK 1 //OK button pressed
  157. #define OLEUI_CANCEL 2 //Cancel button pressed
  158. #define OLEUI_ERR_STANDARDMIN 100
  159. #define OLEUI_ERR_STRUCTURENULL 101 //Standard field validation
  160. #define OLEUI_ERR_STRUCTUREINVALID 102
  161. #define OLEUI_ERR_CBSTRUCTINCORRECT 103
  162. #define OLEUI_ERR_HWNDOWNERINVALID 104
  163. #define OLEUI_ERR_LPSZCAPTIONINVALID 105
  164. #define OLEUI_ERR_LPFNHOOKINVALID 106
  165. #define OLEUI_ERR_HINSTANCEINVALID 107
  166. #define OLEUI_ERR_LPSZTEMPLATEINVALID 108
  167. #define OLEUI_ERR_HRESOURCEINVALID 109
  168. #define OLEUI_ERR_FINDTEMPLATEFAILURE 110 //Initialization errors
  169. #define OLEUI_ERR_LOADTEMPLATEFAILURE 111
  170. #define OLEUI_ERR_DIALOGFAILURE 112
  171. #define OLEUI_ERR_LOCALMEMALLOC 113
  172. #define OLEUI_ERR_GLOBALMEMALLOC 114
  173. #define OLEUI_ERR_LOADSTRING 115
  174. #define OLEUI_ERR_STANDARDMAX 116 //Start here for specific errors.
  175. //Help Button Identifier
  176. #define ID_OLEUIHELP 99
  177. // Help button for fileopen.dlg (need this for resizing) 1038 is pshHelp
  178. #undef IDHELP
  179. #define IDHELP 1038
  180. // Static text control (use this instead of -1 so things work correctly for
  181. // localization
  182. #define ID_STATIC 98
  183. /******************
  184. * The followings are defined in the fashion that the first
  185. * definition is the number of CHARACTERS, while the second one (XXX_SIZE)
  186. * is the number of bytes. The number of bytes definition is needed for
  187. * UNICODE handling purpose.
  188. * Also, please note the prefix of variables cch means that it is the
  189. * count of characters and cb means the count of bytes.
  190. ******************/
  191. //Maximum key size we read from the RegDB.
  192. #define OLEUI_CCHKEYMAX 256 // make any changes to this in geticon.c too
  193. #define OLEUI_CCHKEYMAX_SIZE OLEUI_CCHKEYMAX*sizeof(TCHAR) // # of bytes
  194. //Maximum verb length and length of Object menu
  195. #define OLEUI_CCHVERBMAX 32
  196. #define OLEUI_CCHVERBMAX_SIZE OLEUI_CCHVERBMAX*sizeof(TCHAR) // # of bytes
  197. #define OLEUI_OBJECTMENUMAX 256
  198. #define OLEUI_OBJECTMENUMAX_SIZE OLEUI_OBJECTMENUMAX*sizeof(TCHAR) // # of bytes
  199. //Maximum MS-DOS pathname.
  200. #define OLEUI_CCHPATHMAX 256 // make any changes to this in geticon.c too
  201. #define OLEUI_CCHPATHMAX_SIZE OLEUI_CCHPATHMAX*sizeof(TCHAR) // # of bytes
  202. #define OLEUI_CCHFILEMAX 13
  203. #define OLEUI_CCHFILEMAX_SIZE OLEUI_CCHFILEMAX*sizeof(TCHAR) // # of bytes
  204. //Icon label length
  205. #define OLEUI_CCHLABELMAX 40 // make any changes to this in geticon.c too
  206. #define OLEUI_CCHLABELMAX_SIZE OLEUI_CCHLABELMAX*sizeof(TCHAR) // # of bytes
  207. //Length of the CLSID string
  208. #define OLEUI_CCHCLSIDSTRING 39
  209. #define OLEUI_CCHCLSIDSTRING_SIZE OLEUI_CCHCLSIDSTRING*sizeof(TCHAR) // # of bytes
  210. /*
  211. * What follows here are first function prototypes for general utility
  212. * functions, then sections laid out by dialog. Each dialog section
  213. * defines the dialog structure, the API prototype, flags for the dwFlags
  214. * field, the dialog-specific error values, and dialog control IDs (for
  215. * hooks and custom templates.
  216. */
  217. //Miscellaneous utility functions.
  218. STDAPI_(BOOL) OleUIAddVerbMenu(LPOLEOBJECT lpOleObj,
  219. LPTSTR lpszShortType,
  220. HMENU hMenu,
  221. UINT uPos,
  222. UINT uIDVerbMin,
  223. UINT uIDVerbMax,
  224. BOOL bAddConvert,
  225. UINT idConvert,
  226. HMENU FAR *lphMenu);
  227. //Metafile utility functions
  228. #ifndef WIN32
  229. STDAPI_(HGLOBAL) OleUIMetafilePictFromIconAndLabel(HICON, LPTSTR, LPTSTR, UINT);
  230. #endif
  231. STDAPI_(void) OleUIMetafilePictIconFree(HGLOBAL);
  232. STDAPI_(BOOL) OleUIMetafilePictIconDraw(HDC, LPRECT, HGLOBAL, BOOL);
  233. STDAPI_(UINT) OleUIMetafilePictExtractLabel(HGLOBAL, LPTSTR, UINT, LPDWORD);
  234. STDAPI_(HICON) OleUIMetafilePictExtractIcon(HGLOBAL);
  235. STDAPI_(BOOL) OleUIMetafilePictExtractIconSource(HGLOBAL,LPTSTR,UINT FAR *);
  236. /*************************************************************************
  237. ** INSERT OBJECT DIALOG
  238. *************************************************************************/
  239. typedef struct tagOLEUIINSERTOBJECT
  240. {
  241. //These IN fields are standard across all OLEUI dialog functions.
  242. DWORD cbStruct; //Structure Size
  243. DWORD dwFlags; //IN-OUT: Flags
  244. HWND hWndOwner; //Owning window
  245. LPCTSTR lpszCaption; //Dialog caption bar contents
  246. LPFNOLEUIHOOK lpfnHook; //Hook callback
  247. LPARAM lCustData; //Custom data to pass to hook
  248. HINSTANCE hInstance; //Instance for customized template name
  249. LPCTSTR lpszTemplate; //Customized template name
  250. HRSRC hResource; //Customized template handle
  251. //Specifics for OLEUIINSERTOBJECT. All are IN-OUT unless otherwise spec.
  252. CLSID clsid; //Return space for class ID
  253. LPTSTR lpszFile; //Filename for inserts or links
  254. UINT cchFile; //Size of lpszFile buffer: OLEUI_CCHPATHMAX
  255. UINT cClsidExclude; //IN only: CLSIDs in lpClsidExclude
  256. LPCLSID lpClsidExclude; //List of CLSIDs to exclude from listing.
  257. //Specific to create objects if flags say so
  258. IID iid; //Requested interface on creation.
  259. DWORD oleRender; //Rendering option
  260. LPFORMATETC lpFormatEtc; //Desired format
  261. LPOLECLIENTSITE lpIOleClientSite; //Site to be use for the object.
  262. LPSTORAGE lpIStorage; //Storage used for the object
  263. LPVOID FAR *ppvObj; //Where the object is returned.
  264. SCODE sc; //Result of creation calls.
  265. HGLOBAL hMetaPict; //OUT: METAFILEPICT containing iconic aspect.
  266. //IFF we couldn't stuff it in the cache.
  267. } OLEUIINSERTOBJECT, *POLEUIINSERTOBJECT, FAR *LPOLEUIINSERTOBJECT;
  268. //API prototype
  269. STDAPI_(UINT) OleUIInsertObject(LPOLEUIINSERTOBJECT);
  270. //Insert Object flags
  271. #define IOF_SHOWHELP 0x00000001L
  272. #define IOF_SELECTCREATENEW 0x00000002L
  273. #define IOF_SELECTCREATEFROMFILE 0x00000004L
  274. #define IOF_CHECKLINK 0x00000008L
  275. #define IOF_CHECKDISPLAYASICON 0x00000010L
  276. #define IOF_CREATENEWOBJECT 0x00000020L
  277. #define IOF_CREATEFILEOBJECT 0x00000040L
  278. #define IOF_CREATELINKOBJECT 0x00000080L
  279. #define IOF_DISABLELINK 0x00000100L
  280. #define IOF_VERIFYSERVERSEXIST 0x00000200L
  281. #define IOF_DISABLEDISPLAYASICON 0x00000400L
  282. //Insert Object specific error codes
  283. #define OLEUI_IOERR_LPSZFILEINVALID (OLEUI_ERR_STANDARDMAX+0)
  284. #define OLEUI_IOERR_LPSZLABELINVALID (OLEUI_ERR_STANDARDMAX+1)
  285. #define OLEUI_IOERR_HICONINVALID (OLEUI_ERR_STANDARDMAX+2)
  286. #define OLEUI_IOERR_LPFORMATETCINVALID (OLEUI_ERR_STANDARDMAX+3)
  287. #define OLEUI_IOERR_PPVOBJINVALID (OLEUI_ERR_STANDARDMAX+4)
  288. #define OLEUI_IOERR_LPIOLECLIENTSITEINVALID (OLEUI_ERR_STANDARDMAX+5)
  289. #define OLEUI_IOERR_LPISTORAGEINVALID (OLEUI_ERR_STANDARDMAX+6)
  290. #define OLEUI_IOERR_SCODEHASERROR (OLEUI_ERR_STANDARDMAX+7)
  291. #define OLEUI_IOERR_LPCLSIDEXCLUDEINVALID (OLEUI_ERR_STANDARDMAX+8)
  292. #define OLEUI_IOERR_CCHFILEINVALID (OLEUI_ERR_STANDARDMAX+9)
  293. //Insert Object Dialog identifiers
  294. #define ID_IO_CREATENEW 2100
  295. #define ID_IO_CREATEFROMFILE 2101
  296. #define ID_IO_LINKFILE 2102
  297. #define ID_IO_OBJECTTYPELIST 2103
  298. #define ID_IO_DISPLAYASICON 2104
  299. #define ID_IO_CHANGEICON 2105
  300. #define ID_IO_FILE 2106
  301. #define ID_IO_FILEDISPLAY 2107
  302. #define ID_IO_RESULTIMAGE 2108
  303. #define ID_IO_RESULTTEXT 2109
  304. #define ID_IO_ICONDISPLAY 2110
  305. #define ID_IO_OBJECTTYPETEXT 2111
  306. #define ID_IO_FILETEXT 2112
  307. #define ID_IO_FILETYPE 2113
  308. // Strings in OLE2UI resources
  309. #define IDS_IORESULTNEW 256
  310. #define IDS_IORESULTNEWICON 257
  311. #define IDS_IORESULTFROMFILE1 258
  312. #define IDS_IORESULTFROMFILE2 259
  313. #define IDS_IORESULTFROMFILEICON2 260
  314. #define IDS_IORESULTLINKFILE1 261
  315. #define IDS_IORESULTLINKFILE2 262
  316. #define IDS_IORESULTLINKFILEICON1 263
  317. #define IDS_IORESULTLINKFILEICON2 264
  318. /*************************************************************************
  319. ** PASTE SPECIAL DIALOG
  320. *************************************************************************/
  321. // Maximum number of link types
  322. #define PS_MAXLINKTYPES 8
  323. //NOTE: OLEUIPASTEENTRY and OLEUIPASTEFLAG structs are defined in OLESTD.H
  324. typedef struct tagOLEUIPASTESPECIAL
  325. {
  326. //These IN fields are standard across all OLEUI dialog functions.
  327. DWORD cbStruct; //Structure Size
  328. DWORD dwFlags; //IN-OUT: Flags
  329. HWND hWndOwner; //Owning window
  330. LPCTSTR lpszCaption; //Dialog caption bar contents
  331. LPFNOLEUIHOOK lpfnHook; //Hook callback
  332. LPARAM lCustData; //Custom data to pass to hook
  333. HINSTANCE hInstance; //Instance for customized template name
  334. LPCTSTR lpszTemplate; //Customized template name
  335. HRSRC hResource; //Customized template handle
  336. //Specifics for OLEUIPASTESPECIAL.
  337. //IN fields
  338. LPDATAOBJECT lpSrcDataObj; //Source IDataObject* (on the
  339. // clipboard) for data to paste
  340. LPOLEUIPASTEENTRY arrPasteEntries; //OLEUIPASTEENTRY array which
  341. // specifies acceptable formats. See
  342. // OLEUIPASTEENTRY for more info.
  343. int cPasteEntries; //No. of OLEUIPASTEENTRY array entries
  344. UINT FAR *arrLinkTypes; //List of link types that are
  345. // acceptable. Link types are referred
  346. // to using OLEUIPASTEFLAGS in
  347. // arrPasteEntries
  348. int cLinkTypes; //Number of link types
  349. UINT cClsidExclude; //Number of CLSIDs in lpClsidExclude
  350. LPCLSID lpClsidExclude; //List of CLSIDs to exclude from list.
  351. //OUT fields
  352. int nSelectedIndex; //Index of arrPasteEntries[] that the
  353. // user selected
  354. BOOL fLink; //Indicates if Paste or Paste Link was
  355. // selected by the user
  356. HGLOBAL hMetaPict; //Handle to Metafile containing icon
  357. // and icon title selected by the user
  358. // Use the Metafile utility functions
  359. // defined in this header to
  360. // manipulate hMetaPict
  361. SIZEL sizel; // size of object/link in its source
  362. // if the display aspect chosen by
  363. // the user matches the aspect
  364. // displayed in the source. if
  365. // different aspect is chosen then
  366. // sizel.cx=sizel.cy=0 is returned.
  367. // sizel displayed in source is
  368. // retrieved from the
  369. // ObjectDescriptor if fLink is FALSE
  370. // LinkSrcDescriptor if fLink is TRUE
  371. } OLEUIPASTESPECIAL, *POLEUIPASTESPECIAL, FAR *LPOLEUIPASTESPECIAL;
  372. //API to bring up PasteSpecial dialog
  373. STDAPI_(UINT) OleUIPasteSpecial(LPOLEUIPASTESPECIAL);
  374. //Paste Special flags
  375. // Show Help button. IN flag.
  376. #define PSF_SHOWHELP 0x00000001L
  377. //Select Paste radio button at dialog startup. This is the default if
  378. // PSF_SELECTPASTE or PSF_SELECTPASTELINK are not specified. Also specifies
  379. // state of button on dialog termination. IN/OUT flag.
  380. #define PSF_SELECTPASTE 0x00000002L
  381. //Select PasteLink radio button at dialog startup. Also specifies state of
  382. // button on dialog termination. IN/OUT flag.
  383. #define PSF_SELECTPASTELINK 0x00000004L
  384. //Specfies if DisplayAsIcon button was checked on dialog termination. OUT flag
  385. #define PSF_CHECKDISPLAYASICON 0x00000008L
  386. #define PSF_DISABLEDISPLAYASICON 0x00000010L
  387. //Paste Special specific error codes
  388. #define OLEUI_IOERR_SRCDATAOBJECTINVALID (OLEUI_ERR_STANDARDMAX+0)
  389. #define OLEUI_IOERR_ARRPASTEENTRIESINVALID (OLEUI_ERR_STANDARDMAX+1)
  390. #define OLEUI_IOERR_ARRLINKTYPESINVALID (OLEUI_ERR_STANDARDMAX+2)
  391. #define OLEUI_PSERR_CLIPBOARDCHANGED (OLEUI_ERR_STANDARDMAX+3)
  392. //Paste Special Dialog identifiers
  393. #define ID_PS_PASTE 500
  394. #define ID_PS_PASTELINK 501
  395. #define ID_PS_SOURCETEXT 502
  396. #define ID_PS_PASTELIST 503
  397. #define ID_PS_PASTELINKLIST 504
  398. #define ID_PS_DISPLAYLIST 505
  399. #define ID_PS_DISPLAYASICON 506
  400. #define ID_PS_ICONDISPLAY 507
  401. #define ID_PS_CHANGEICON 508
  402. #define ID_PS_RESULTIMAGE 509
  403. #define ID_PS_RESULTTEXT 510
  404. #define ID_PS_RESULTGROUP 511
  405. #define ID_PS_STXSOURCE 512
  406. #define ID_PS_STXAS 513
  407. // Paste Special String IDs
  408. #define IDS_PSPASTEDATA 400
  409. #define IDS_PSPASTEOBJECT 401
  410. #define IDS_PSPASTEOBJECTASICON 402
  411. #define IDS_PSPASTELINKDATA 403
  412. #define IDS_PSPASTELINKOBJECT 404
  413. #define IDS_PSPASTELINKOBJECTASICON 405
  414. #define IDS_PSNONOLE 406
  415. #define IDS_PSUNKNOWNTYPE 407
  416. #define IDS_PSUNKNOWNSRC 408
  417. #define IDS_PSUNKNOWNAPP 409
  418. /*************************************************************************
  419. ** EDIT LINKS DIALOG
  420. *************************************************************************/
  421. /* IOleUILinkContainer Interface
  422. ** -----------------------------
  423. ** This interface must be implemented by container applications that
  424. ** want to use the EditLinks dialog. the EditLinks dialog calls back
  425. ** to the container app to perform the OLE functions to manipulate
  426. ** the links within the container.
  427. */
  428. #define LPOLEUILINKCONTAINER IOleUILinkContainer FAR*
  429. #undef INTERFACE
  430. #define INTERFACE IOleUILinkContainer
  431. DECLARE_INTERFACE_(IOleUILinkContainer, IUnknown)
  432. {
  433. //*** IUnknown methods ***/
  434. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  435. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  436. STDMETHOD_(ULONG,Release) (THIS) PURE;
  437. STDMETHOD_(DWORD,GetNextLink) (THIS_ DWORD dwLink) PURE;
  438. STDMETHOD(SetLinkUpdateOptions) (THIS_ DWORD dwLink, DWORD dwUpdateOpt) PURE;
  439. STDMETHOD(GetLinkUpdateOptions) (THIS_ DWORD dwLink, DWORD FAR* lpdwUpdateOpt) PURE;
  440. STDMETHOD(SetLinkSource) (THIS_
  441. DWORD dwLink,
  442. LPTSTR lpszDisplayName,
  443. ULONG lenFileName,
  444. ULONG FAR* pchEaten,
  445. BOOL fValidateSource) PURE;
  446. STDMETHOD(GetLinkSource) (THIS_
  447. DWORD dwLink,
  448. LPTSTR FAR* lplpszDisplayName,
  449. ULONG FAR* lplenFileName,
  450. LPTSTR FAR* lplpszFullLinkType,
  451. LPTSTR FAR* lplpszShortLinkType,
  452. BOOL FAR* lpfSourceAvailable,
  453. BOOL FAR* lpfIsSelected) PURE;
  454. STDMETHOD(OpenLinkSource) (THIS_ DWORD dwLink) PURE;
  455. STDMETHOD(UpdateLink) (THIS_
  456. DWORD dwLink,
  457. BOOL fErrorMessage,
  458. BOOL fErrorAction) PURE;
  459. STDMETHOD(CancelLink) (THIS_ DWORD dwLink) PURE;
  460. };
  461. typedef struct tagOLEUIEDITLINKS
  462. {
  463. //These IN fields are standard across all OLEUI dialog functions.
  464. DWORD cbStruct; //Structure Size
  465. DWORD dwFlags; //IN-OUT: Flags
  466. HWND hWndOwner; //Owning window
  467. LPCTSTR lpszCaption; //Dialog caption bar contents
  468. LPFNOLEUIHOOK lpfnHook; //Hook callback
  469. LPARAM lCustData; //Custom data to pass to hook
  470. HINSTANCE hInstance; //Instance for customized template name
  471. LPCTSTR lpszTemplate; //Customized template name
  472. HRSRC hResource; //Customized template handle
  473. //Specifics for OLEUI<STRUCT>. All are IN-OUT unless otherwise spec.
  474. LPOLEUILINKCONTAINER lpOleUILinkContainer; //IN: Interface to manipulate
  475. //links in the container
  476. } OLEUIEDITLINKS, *POLEUIEDITLINKS, FAR *LPOLEUIEDITLINKS;
  477. //API Prototype
  478. STDAPI_(UINT) OleUIEditLinks(LPOLEUIEDITLINKS);
  479. // Edit Links flags
  480. #define ELF_SHOWHELP 0x00000001L
  481. #define ELF_DISABLEUPDATENOW 0x00000002L
  482. #define ELF_DISABLEOPENSOURCE 0x00000004L
  483. #define ELF_DISABLECHANGESOURCE 0x00000008L
  484. #define ELF_DISABLECANCELLINK 0x00000010L
  485. // Edit Links Dialog identifiers
  486. #define ID_EL_CHANGESOURCE 201
  487. #define ID_EL_AUTOMATIC 202
  488. #define ID_EL_CLOSE 208
  489. #define ID_EL_CANCELLINK 209
  490. #define ID_EL_UPDATENOW 210
  491. #define ID_EL_OPENSOURCE 211
  492. #define ID_EL_MANUAL 212
  493. #define ID_EL_LINKSOURCE 216
  494. #define ID_EL_LINKTYPE 217
  495. #define ID_EL_UPDATE 218
  496. #define ID_EL_NULL -1
  497. #define ID_EL_LINKSLISTBOX 206
  498. #define ID_EL_COL1 220
  499. #define ID_EL_COL2 221
  500. #define ID_EL_COL3 222
  501. /*************************************************************************
  502. ** CHANGE ICON DIALOG
  503. *************************************************************************/
  504. typedef struct tagOLEUICHANGEICON
  505. {
  506. //These IN fields are standard across all OLEUI dialog functions.
  507. DWORD cbStruct; //Structure Size
  508. DWORD dwFlags; //IN-OUT: Flags
  509. HWND hWndOwner; //Owning window
  510. LPCTSTR lpszCaption; //Dialog caption bar contents
  511. LPFNOLEUIHOOK lpfnHook; //Hook callback
  512. LPARAM lCustData; //Custom data to pass to hook
  513. HINSTANCE hInstance; //Instance for customized template name
  514. LPCTSTR lpszTemplate; //Customized template name
  515. HRSRC hResource; //Customized template handle
  516. //Specifics for OLEUICHANGEICON. All are IN-OUT unless otherwise spec.
  517. HGLOBAL hMetaPict; //Current and final image. Source of the
  518. //icon is embedded in the metafile itself.
  519. CLSID clsid; //IN only: class used to get Default icon
  520. TCHAR szIconExe[OLEUI_CCHPATHMAX];
  521. int cchIconExe;
  522. } OLEUICHANGEICON, *POLEUICHANGEICON, FAR *LPOLEUICHANGEICON;
  523. //API prototype
  524. STDAPI_(UINT) OleUIChangeIcon(LPOLEUICHANGEICON);
  525. //Change Icon flags
  526. #define CIF_SHOWHELP 0x00000001L
  527. #define CIF_SELECTCURRENT 0x00000002L
  528. #define CIF_SELECTDEFAULT 0x00000004L
  529. #define CIF_SELECTFROMFILE 0x00000008L
  530. #define CIF_USEICONEXE 0x0000000aL
  531. //Change Icon specific error codes
  532. #define OLEUI_CIERR_MUSTHAVECLSID (OLEUI_ERR_STANDARDMAX+0)
  533. #define OLEUI_CIERR_MUSTHAVECURRENTMETAFILE (OLEUI_ERR_STANDARDMAX+1)
  534. #define OLEUI_CIERR_SZICONEXEINVALID (OLEUI_ERR_STANDARDMAX+2)
  535. //Change Icon Dialog identifiers
  536. #define ID_GROUP 120
  537. #define ID_CURRENT 121
  538. #define ID_CURRENTICON 122
  539. #define ID_DEFAULT 123
  540. #define ID_DEFAULTICON 124
  541. #define ID_FROMFILE 125
  542. #define ID_FROMFILEEDIT 126
  543. #define ID_ICONLIST 127
  544. #define ID_LABEL 128
  545. #define ID_LABELEDIT 129
  546. #define ID_BROWSE 130
  547. #define ID_RESULTICON 132
  548. #define ID_RESULTLABEL 133
  549. // Stringtable defines for Change Icon
  550. #define IDS_CINOICONSINFILE 288
  551. #define IDS_CIINVALIDFILE 289
  552. #define IDS_CIFILEACCESS 290
  553. #define IDS_CIFILESHARE 291
  554. #define IDS_CIFILEOPENFAIL 292
  555. /*************************************************************************
  556. ** CONVERT DIALOG
  557. *************************************************************************/
  558. typedef struct tagOLEUICONVERT
  559. {
  560. //These IN fields are standard across all OLEUI dialog functions.
  561. DWORD cbStruct; //Structure Size
  562. DWORD dwFlags; //IN-OUT: Flags
  563. HWND hWndOwner; //Owning window
  564. LPCTSTR lpszCaption; //Dialog caption bar contents
  565. LPFNOLEUIHOOK lpfnHook; //Hook callback
  566. LPARAM lCustData; //Custom data to pass to hook
  567. HINSTANCE hInstance; //Instance for customized template name
  568. LPCTSTR lpszTemplate; //Customized template name
  569. HRSRC hResource; //Customized template handle
  570. //Specifics for OLEUICONVERT. All are IN-OUT unless otherwise spec.
  571. CLSID clsid; //Class ID sent in to dialog: IN only
  572. CLSID clsidConvertDefault; //Class ID to use as convert default: IN only
  573. CLSID clsidActivateDefault; //Class ID to use as activate default: IN only
  574. CLSID clsidNew; //Selected Class ID: OUT only
  575. DWORD dvAspect; //IN-OUT, either DVASPECT_CONTENT or
  576. //DVASPECT_ICON
  577. WORD wFormat; //Original data format
  578. BOOL fIsLinkedObject; //IN only; true if object is linked
  579. HGLOBAL hMetaPict; //IN-OUT: METAFILEPICT containing iconic aspect.
  580. LPTSTR lpszUserType; //IN-OUT: user type name of original class.
  581. // We'll do lookup if it's NULL.
  582. // This gets freed on exit.
  583. BOOL fObjectsIconChanged; // OUT; TRUE if ChangeIcon was called (and not cancelled)
  584. LPTSTR lpszDefLabel; //IN-OUT: default label to use for icon.
  585. // if NULL, the short user type name
  586. // will be used. if the object is a
  587. // link, the caller should pass the
  588. // DisplayName of the link source
  589. // This gets freed on exit.
  590. UINT cClsidExclude; //IN: No. of CLSIDs in lpClsidExclude
  591. LPCLSID lpClsidExclude; //IN: List of CLSIDs to exclude from list
  592. } OLEUICONVERT, *POLEUICONVERT, FAR *LPOLEUICONVERT;
  593. //API prototype
  594. STDAPI_(UINT) OleUIConvert(LPOLEUICONVERT);
  595. // Determine if there is at least one class that can Convert or ActivateAs
  596. // the given clsid.
  597. STDAPI_(BOOL) OleUICanConvertOrActivateAs(
  598. REFCLSID rClsid,
  599. BOOL fIsLinkedObject,
  600. WORD wFormat
  601. );
  602. //Convert Dialog flags
  603. // IN only: Shows "HELP" button
  604. #define CF_SHOWHELPBUTTON 0x00000001L
  605. // IN only: lets you set the convert default object - the one that is
  606. // selected as default in the convert listbox.
  607. #define CF_SETCONVERTDEFAULT 0x00000002L
  608. // IN only: lets you set the activate default object - the one that is
  609. // selected as default in the activate listbox.
  610. #define CF_SETACTIVATEDEFAULT 0x00000004L
  611. // IN/OUT: Selects the "Convert To" radio button, is set on exit if
  612. // this button was selected
  613. #define CF_SELECTCONVERTTO 0x00000008L
  614. // IN/OUT: Selects the "Activate As" radio button, is set on exit if
  615. // this button was selected
  616. #define CF_SELECTACTIVATEAS 0x00000010L
  617. #define CF_DISABLEDISPLAYASICON 0x00000020L
  618. #define CF_DISABLEACTIVATEAS 0x00000040L
  619. //Convert specific error codes
  620. #define OLEUI_CTERR_CLASSIDINVALID (OLEUI_ERR_STANDARDMAX+1)
  621. #define OLEUI_CTERR_DVASPECTINVALID (OLEUI_ERR_STANDARDMAX+2)
  622. #define OLEUI_CTERR_CBFORMATINVALID (OLEUI_ERR_STANDARDMAX+3)
  623. #define OLEUI_CTERR_HMETAPICTINVALID (OLEUI_ERR_STANDARDMAX+4)
  624. #define OLEUI_CTERR_STRINGINVALID (OLEUI_ERR_STANDARDMAX+5)
  625. //Convert Dialog identifiers
  626. #define IDCV_OBJECTTYPE 150
  627. #define IDCV_DISPLAYASICON 152
  628. #define IDCV_CHANGEICON 153
  629. #define IDCV_ACTIVATELIST 154
  630. #define IDCV_CONVERTTO 155
  631. #define IDCV_ACTIVATEAS 156
  632. #define IDCV_RESULTTEXT 157
  633. #define IDCV_CONVERTLIST 158
  634. #define IDCV_ICON 159
  635. #define IDCV_ICONLABEL1 160
  636. #define IDCV_ICONLABEL2 161
  637. #define IDCV_STXCURTYPE 162
  638. #define IDCV_GRPRESULT 163
  639. #define IDCV_STXCONVERTTO 164
  640. // String IDs for Convert dialog
  641. #define IDS_CVRESULTCONVERTLINK 500
  642. #define IDS_CVRESULTCONVERTTO 501
  643. #define IDS_CVRESULTNOCHANGE 502
  644. #define IDS_CVRESULTDISPLAYASICON 503
  645. #define IDS_CVRESULTACTIVATEAS 504
  646. #define IDS_CVRESULTACTIVATEDIFF 505
  647. /*************************************************************************
  648. ** BUSY DIALOG
  649. *************************************************************************/
  650. typedef struct tagOLEUIBUSY
  651. {
  652. //These IN fields are standard across all OLEUI dialog functions.
  653. DWORD cbStruct; //Structure Size
  654. DWORD dwFlags; //IN-OUT: Flags ** NOTE ** this dialog has no flags
  655. HWND hWndOwner; //Owning window
  656. LPCTSTR lpszCaption; //Dialog caption bar contents
  657. LPFNOLEUIHOOK lpfnHook; //Hook callback
  658. LPARAM lCustData; //Custom data to pass to hook
  659. HINSTANCE hInstance; //Instance for customized template name
  660. LPCTSTR lpszTemplate; //Customized template name
  661. HRSRC hResource; //Customized template handle
  662. //Specifics for OLEUIBUSY.
  663. HTASK hTask; //IN: HTask which is blocking
  664. HWND FAR * lphWndDialog; //IN: Dialog's HWND is placed here
  665. } OLEUIBUSY, *POLEUIBUSY, FAR *LPOLEUIBUSY;
  666. //API prototype
  667. STDAPI_(UINT) OleUIBusy(LPOLEUIBUSY);
  668. // Flags for this dialog
  669. // IN only: Disables "Cancel" button
  670. #define BZ_DISABLECANCELBUTTON 0x00000001L
  671. // IN only: Disables "Switch To..." button
  672. #define BZ_DISABLESWITCHTOBUTTON 0x00000002L
  673. // IN only: Disables "Retry" button
  674. #define BZ_DISABLERETRYBUTTON 0x00000004L
  675. // IN only: Generates a "Not Responding" dialog as opposed to the
  676. // "Busy" dialog. The wording in the text is slightly different, and
  677. // the "Cancel" button is grayed out if you set this flag.
  678. #define BZ_NOTRESPONDINGDIALOG 0x00000008L
  679. // Busy specific error/return codes
  680. #define OLEUI_BZERR_HTASKINVALID (OLEUI_ERR_STANDARDMAX+0)
  681. // SWITCHTOSELECTED is returned when user hit "switch to"
  682. #define OLEUI_BZ_SWITCHTOSELECTED (OLEUI_ERR_STANDARDMAX+1)
  683. // RETRYSELECTED is returned when user hit "retry"
  684. #define OLEUI_BZ_RETRYSELECTED (OLEUI_ERR_STANDARDMAX+2)
  685. // CALLUNBLOCKED is returned when call has been unblocked
  686. #define OLEUI_BZ_CALLUNBLOCKED (OLEUI_ERR_STANDARDMAX+3)
  687. // Busy dialog identifiers
  688. #define IDBZ_RETRY 600
  689. #define IDBZ_ICON 601
  690. #define IDBZ_MESSAGE1 602
  691. #define IDBZ_SWITCHTO 604
  692. // Busy dialog stringtable defines
  693. #define IDS_BZRESULTTEXTBUSY 601
  694. #define IDS_BZRESULTTEXTNOTRESPONDING 602
  695. // Links dialog stringtable defines
  696. #define IDS_LINK_AUTO 800
  697. #define IDS_LINK_MANUAL 801
  698. #define IDS_LINK_UNKNOWN 802
  699. #define IDS_LINKS 803
  700. #define IDS_FAILED 804
  701. #define IDS_CHANGESOURCE 805
  702. #define IDS_INVALIDSOURCE 806
  703. #define IDS_ERR_GETLINKSOURCE 807
  704. #define IDS_ERR_GETLINKUPDATEOPTIONS 808
  705. #define IDS_ERR_ADDSTRING 809
  706. #define IDS_CHANGEADDITIONALLINKS 810
  707. #define IDS_CLOSE 811
  708. /*************************************************************************
  709. ** PROMPT USER DIALOGS
  710. *************************************************************************/
  711. #define ID_PU_LINKS 900
  712. #define ID_PU_TEXT 901
  713. #define ID_PU_CONVERT 902
  714. #define ID_PU_BROWSE 904
  715. #define ID_PU_METER 905
  716. #define ID_PU_PERCENT 906
  717. #define ID_PU_STOP 907
  718. // used for -1 ids in dialogs:
  719. #define ID_DUMMY 999
  720. /* inside ole2ui.c */
  721. #ifdef __cplusplus
  722. extern "C"
  723. #endif
  724. int EXPORT FAR CDECL OleUIPromptUser(int nTemplate, HWND hwndParent, ...);
  725. #define UPDATELINKS_STARTDELAY 2000 // Delay before 1st link updates
  726. // to give the user a chance to
  727. // dismiss the dialog before any
  728. // links update.
  729. STDAPI_(BOOL) OleUIUpdateLinks(
  730. LPOLEUILINKCONTAINER lpOleUILinkCntr,
  731. HWND hwndParent,
  732. LPTSTR lpszTitle,
  733. int cLinks);
  734. /*************************************************************************
  735. ** OLE OBJECT FEEDBACK EFFECTS
  736. *************************************************************************/
  737. #define OLEUI_HANDLES_USEINVERSE 0x00000001L
  738. #define OLEUI_HANDLES_NOBORDER 0x00000002L
  739. #define OLEUI_HANDLES_INSIDE 0x00000004L
  740. #define OLEUI_HANDLES_OUTSIDE 0x00000008L
  741. #define OLEUI_SHADE_FULLRECT 1
  742. #define OLEUI_SHADE_BORDERIN 2
  743. #define OLEUI_SHADE_BORDEROUT 3
  744. /* objfdbk.c function prototypes */
  745. STDAPI_(void) OleUIDrawHandles(LPRECT lpRect, HDC hdc, DWORD dwFlags, UINT cSize, BOOL fDraw);
  746. STDAPI_(void) OleUIDrawShading(LPRECT lpRect, HDC hdc, DWORD dwFlags, UINT cWidth);
  747. STDAPI_(void) OleUIShowObject(LPCRECT lprc, HDC hdc, BOOL fIsLink);
  748. /*************************************************************************
  749. ** Hatch window definitions and prototypes **
  750. *************************************************************************/
  751. #define DEFAULT_HATCHBORDER_WIDTH 4
  752. STDAPI_(BOOL) RegisterHatchWindowClass(HINSTANCE hInst);
  753. STDAPI_(HWND) CreateHatchWindow(HWND hWndParent, HINSTANCE hInst);
  754. STDAPI_(UINT) GetHatchWidth(HWND hWndHatch);
  755. STDAPI_(void) GetHatchRect(HWND hWndHatch, LPRECT lpHatchRect);
  756. STDAPI_(void) SetHatchRect(HWND hWndHatch, LPRECT lprcHatchRect);
  757. STDAPI_(void) SetHatchWindowSize(
  758. HWND hWndHatch,
  759. LPRECT lprcIPObjRect,
  760. LPRECT lprcClipRect,
  761. LPPOINT lpptOffset
  762. );
  763. /*************************************************************************
  764. ** VERSION VERIFICATION INFORMATION
  765. *************************************************************************/
  766. // The following magic number is used to verify that the resources we bind
  767. // to our EXE are the same "version" as the LIB (or DLL) file which
  768. // contains these routines. This is not the same as the Version information
  769. // resource that we place in OLE2UI.RC, this is a special ID that we will
  770. // have compiled in to our EXE. Upon initialization of OLE2UI, we will
  771. // look in our resources for an RCDATA called "VERIFICATION" (see OLE2UI.RC),
  772. // and make sure that the magic number there equals the magic number below.
  773. #define OLEUI_VERSION_MAGIC 0x4D42
  774. #endif //_OLE2UI_H_