home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Intshcut.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-14  |  14.7 KB  |  405 lines

  1. /*
  2.  * intshcut.h - Internet Shortcut interface definitions.
  3.  *
  4.  * Copyright (c) 1995-1996, Microsoft Corporation.  All rights reserved.
  5.  */
  6.  
  7. #ifndef __INTSHCUT_H__
  8. #define __INTSHCUT_H__
  9.  
  10. /* Headers
  11.  **********/
  12.  
  13. #include <isguids.h>
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {                        /* Assume C declarations for C++. */
  17. #endif   /* __cplusplus */
  18.  
  19. /* Constants
  20.  ************/
  21.  
  22. /* Define API decoration for direct import of DLL functions. */
  23.  
  24. #ifdef _INTSHCUT_
  25. #define INTSHCUTAPI
  26. #else
  27. #define INTSHCUTAPI                 DECLSPEC_IMPORT
  28. #endif
  29.  
  30. /* HRESULTs */
  31.  
  32. //
  33. // MessageId: E_FLAGS
  34. //
  35. // MessageText:
  36. //
  37. //  The flag combination is invalid.
  38. //
  39. #define E_FLAGS                     MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1000)
  40.  
  41. //
  42. // MessageId: IS_E_EXEC_FAILED
  43. //
  44. // MessageText:
  45. //
  46. //  The URL's protocol handler failed to run.
  47. //
  48. #define IS_E_EXEC_FAILED            MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x2002)
  49.  
  50. //
  51. // MessageId: URL_E_INVALID_SYNTAX
  52. //
  53. // MessageText:
  54. //
  55. //  The URL's syntax is invalid.
  56. //
  57. #define URL_E_INVALID_SYNTAX        MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1001)
  58.  
  59. //
  60. // MessageId: URL_E_UNREGISTERED_PROTOCOL
  61. //
  62. // MessageText:
  63. //
  64. //  The URL's protocol does not have a registered protocol handler.
  65. //
  66. #define URL_E_UNREGISTERED_PROTOCOL MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1002)
  67.  
  68. /* Interfaces
  69.  *************/
  70.  
  71. //
  72. // Input flags for IUniformResourceLocator::SetURL().
  73. //
  74. typedef enum iurl_seturl_flags
  75. {
  76.    IURL_SETURL_FL_GUESS_PROTOCOL        = 0x0001,     // Guess protocol if missing
  77.    IURL_SETURL_FL_USE_DEFAULT_PROTOCOL  = 0x0002,     // Use default protocol if missing
  78. }
  79. IURL_SETURL_FLAGS;
  80.  
  81. //
  82. // Input flags for IUniformResourceLocator()::InvokeCommand().
  83. //
  84. typedef enum iurl_invokecommand_flags
  85. {
  86.    IURL_INVOKECOMMAND_FL_ALLOW_UI                  = 0x0001,
  87.    IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB          = 0x0002,    // Ignore pcszVerb
  88. }
  89. IURL_INVOKECOMMAND_FLAGS;
  90.  
  91. //
  92. // Command info for IUniformResourceLocator::InvokeCommand().
  93. //
  94.  
  95. typedef struct urlinvokecommandinfoA
  96. {
  97.    DWORD  dwcbSize;          // Size of structure
  98.    DWORD  dwFlags;           // Bit field of IURL_INVOKECOMMAND_FLAGS
  99.    HWND   hwndParent;        // Parent window.  Valid only if IURL_INVOKECOMMAND_FL_ALLOW_UI is set.
  100.    LPCSTR pcszVerb;          // Verb to invoke.  Ignored if IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB is set.
  101. }
  102. URLINVOKECOMMANDINFOA;
  103. typedef URLINVOKECOMMANDINFOA *PURLINVOKECOMMANDINFOA;
  104. typedef const URLINVOKECOMMANDINFOA CURLINVOKECOMMANDINFOA;
  105. typedef const URLINVOKECOMMANDINFOA *PCURLINVOKECOMMANDINFOA;
  106.  
  107. typedef struct urlinvokecommandinfoW
  108. {
  109.    DWORD   dwcbSize;          // Size of structure
  110.    DWORD   dwFlags;           // Bit field of IURL_INVOKECOMMAND_FLAGS
  111.    HWND    hwndParent;        // Parent window.  Valid only if IURL_INVOKECOMMAND_FL_ALLOW_UI is set.
  112.    LPCWSTR pcszVerb;          // Verb to invoke.  Ignored if IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB is set.
  113. }
  114. URLINVOKECOMMANDINFOW;
  115. typedef URLINVOKECOMMANDINFOW *PURLINVOKECOMMANDINFOW;
  116. typedef const URLINVOKECOMMANDINFOW CURLINVOKECOMMANDINFOW;
  117. typedef const URLINVOKECOMMANDINFOW *PCURLINVOKECOMMANDINFOW;
  118.  
  119. #ifdef UNICODE
  120. #define URLINVOKECOMMANDINFO            URLINVOKECOMMANDINFOW
  121. #define PURLINVOKECOMMANDINFO           PURLINVOKECOMMANDINFOW
  122. #define CURLINVOKECOMMANDINFO           CURLINVOKECOMMANDINFOW
  123. #define PCURLINVOKECOMMANDINFO          PCURLINVOKECOMMANDINFOW
  124. #else
  125. #define URLINVOKECOMMANDINFO            URLINVOKECOMMANDINFOA
  126. #define PURLINVOKECOMMANDINFO           PURLINVOKECOMMANDINFOA
  127. #define CURLINVOKECOMMANDINFO           CURLINVOKECOMMANDINFOA
  128. #define PCURLINVOKECOMMANDINFO          PCURLINVOKECOMMANDINFOA
  129. #endif
  130.  
  131.  
  132. #undef  INTERFACE
  133. #define INTERFACE IUniformResourceLocatorA
  134.  
  135. DECLARE_INTERFACE_(IUniformResourceLocatorA, IUnknown)
  136. {
  137.    /* IUnknown methods */
  138.  
  139.    STDMETHOD(QueryInterface)(THIS_
  140.                              REFIID riid,
  141.                              PVOID *ppvObject) PURE;
  142.    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  143.    STDMETHOD_(ULONG, Release)(THIS) PURE;
  144.  
  145.    /* IUniformResourceLocator methods */
  146.  
  147.    STDMETHOD(SetURL)(THIS_
  148.                      LPCSTR pcszURL,
  149.                      DWORD dwInFlags) PURE;
  150.  
  151.    STDMETHOD(GetURL)(THIS_
  152.                      LPSTR *ppszURL) PURE;
  153.  
  154.    STDMETHOD(InvokeCommand)(THIS_
  155.                             PURLINVOKECOMMANDINFOA purlici) PURE;
  156. };
  157.  
  158. #undef  INTERFACE
  159. #define INTERFACE IUniformResourceLocatorW
  160.  
  161. DECLARE_INTERFACE_(IUniformResourceLocatorW, IUnknown)
  162. {
  163.    /* IUnknown methods */
  164.  
  165.    STDMETHOD(QueryInterface)(THIS_
  166.                              REFIID riid,
  167.                              PVOID *ppvObject) PURE;
  168.    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  169.    STDMETHOD_(ULONG, Release)(THIS) PURE;
  170.  
  171.    /* IUniformResourceLocator methods */
  172.  
  173.    STDMETHOD(SetURL)(THIS_
  174.                      LPCWSTR pcszURL,
  175.                      DWORD dwInFlags) PURE;
  176.  
  177.    STDMETHOD(GetURL)(THIS_
  178.                      LPWSTR *ppszURL) PURE;
  179.  
  180.    STDMETHOD(InvokeCommand)(THIS_
  181.                             PURLINVOKECOMMANDINFOW purlici) PURE;
  182. };
  183.  
  184. #ifdef UNICODE
  185. #define IUniformResourceLocator         IUniformResourceLocatorW
  186. #define IUniformResourceLocatorVtbl     IUniformResourceLocatorWVtbl
  187. #else
  188. #define IUniformResourceLocator         IUniformResourceLocatorA
  189. #define IUniformResourceLocatorVtbl     IUniformResourceLocatorAVtbl
  190. #endif
  191.  
  192. typedef IUniformResourceLocator *PIUniformResourceLocator;
  193. typedef const IUniformResourceLocator CIUniformResourceLocator;
  194. typedef const IUniformResourceLocator *PCIUniformResourceLocator;
  195.  
  196. /* Prototypes
  197.  *************/
  198.  
  199. //
  200. // Input flags for TranslateURL().
  201. //
  202. typedef enum translateurl_in_flags
  203. {
  204.    TRANSLATEURL_FL_GUESS_PROTOCOL         = 0x0001,     // Guess protocol if missing
  205.    TRANSLATEURL_FL_USE_DEFAULT_PROTOCOL   = 0x0002,     // Use default protocol if missing
  206. }
  207. TRANSLATEURL_IN_FLAGS;
  208.  
  209. //
  210. //   TranslateURL().  This function applies common translations to a URL
  211. //  string, creating a new URL string.
  212. //
  213. //   This function does not perform any validation on the syntax of the input
  214. //  URL string.  A successful return value does not indicate that the input
  215. //  or output URL strings are valid URLS.
  216. //
  217. //   The function returns S_OK if the URL string is translated successfully
  218. //  and *ppszTranslatedURL points to the translated URL string.  S_FALSE
  219. //  is returned if the URL string did not require translation.  An error
  220. //  code is returned if an error occurs.
  221. //
  222. //  Parameters:
  223. //   pcszURL -- A pointer to the URL string to be translated.
  224. //   dwInFlags -- A bit field of TRANSLATEURL_IN_FLAGS.
  225. //   ppszTranslatedURL -- A pointer to the newly created, translated URL
  226. //     string, if any.  *ppszTranslatedURL is only valid if S_OK is returned.
  227. //     If valid, *ppszTranslatedURL should be freed by calling LocalFree().
  228. //     *ppszTranslatedURL is NULL on error.
  229. //
  230.  
  231. INTSHCUTAPI HRESULT WINAPI TranslateURLA(PCSTR pcszURL,
  232.                                          DWORD dwInFlags,
  233.                                          PSTR *ppszTranslatedURL);
  234. INTSHCUTAPI HRESULT WINAPI TranslateURLW(PCWSTR pcszURL,
  235.                                          DWORD dwInFlags,
  236.                                          PWSTR *ppszTranslatedURL);
  237. #ifdef UNICODE
  238. #define TranslateURL             TranslateURLW
  239. #else
  240. #define TranslateURL             TranslateURLA
  241. #endif   /* UNICODE */
  242.  
  243. //
  244. // Input flags for URLAssociationDialog().
  245. //
  246. typedef enum urlassociationdialog_in_flags
  247. {
  248.    URLASSOCDLG_FL_USE_DEFAULT_NAME        = 0x0001,
  249.    URLASSOCDLG_FL_REGISTER_ASSOC          = 0x0002,
  250. }
  251. URLASSOCIATIONDIALOG_IN_FLAGS;
  252.  
  253. //
  254. //   URLAssocationDialog().  This function invokes the unregistered URL
  255. //  protocol dialog box, providing a standard ui for choosing the handler for
  256. //  an unregistered URL protocol.
  257. //
  258. //  The functions returns S_OK if the application is registered with the
  259. //  URL protocol.  S_FALSE is returned if nothing is registered (a one-time
  260. //  execution via the selected application is requested).
  261. //
  262. //  Parameters:
  263. //   hwndParent -- A handle to the window to be used as the parent
  264. //   dwInFlags -- A bit field of URLASSOCIATIONDIALOG_IN_FLAGS.  The
  265. //                flags are:
  266. //
  267. //                  URLASSOCDLG_FL_USE_DEFAULT_NAME: Use the default Internet
  268. //                   Shortcut file name.  Ignore pcszFile.
  269. //
  270. //                  URLASSOCDLG_FL_REGISTER_ASSOC: The application
  271. //                   selected is to be registered as the handler for URLs
  272. //                   of pcszURL's protocol.  An application is only
  273. //                   registered if this flag is set, and the user indicates
  274. //                   that a persistent association is to be made.
  275. //
  276. //   pcszFile -- The name of the Internet Shortcut file whose URL's protocol
  277. //               requires a protocol handler.  Before a verb, like "open", can
  278. //               be invoked on an Internet Shortcut, a protocol handler must be
  279. //               registered for its URL protocol.  If
  280. //               URLASSOCDLG_FL_USE_DEFAULT_NAME is set in dwInFlags, pcszFile
  281. //               is ignored, and a default Internet Shortcut file name is used.
  282. //               pcszFile is only used for ui.
  283. //   pcszURL -- The URL whose unregistered protocol requires a handler.
  284. //   pszAppBuf -- A buffer to be filled in on success with the path
  285. //                of the application selected by the user.  pszAppBuf's
  286. //                buffer is filled in with the empty string on failure.
  287. //   ucAppBufLen -- The length of pszAppBuf's buffer in characters.
  288. //
  289.  
  290. INTSHCUTAPI HRESULT WINAPI URLAssociationDialogA(HWND hwndParent,
  291.                                                  DWORD dwInFlags,
  292.                                                  PCSTR pcszFile,
  293.                                                  PCSTR pcszURL,
  294.                                                  PSTR pszAppBuf,
  295.                                                  UINT ucAppBufLen);
  296. INTSHCUTAPI HRESULT WINAPI URLAssociationDialogW(HWND hwndParent,
  297.                                                  DWORD dwInFlags,
  298.                                                  PCWSTR pcszFile,
  299.                                                  PCWSTR pcszURL,
  300.                                                  PWSTR pszAppBuf,
  301.                                                  UINT ucAppBufLen);
  302. #ifdef UNICODE
  303. #define URLAssociationDialog     URLAssociationDialogW
  304. #else
  305. #define URLAssociationDialog     URLAssociationDialogA
  306. #endif  /* UNICODE */
  307.  
  308. //
  309. // Input flags for MIMEAssocationDialog().
  310. //
  311. typedef enum mimeassociationdialog_in_flags
  312. {
  313.    MIMEASSOCDLG_FL_REGISTER_ASSOC         = 0x0001,
  314. }
  315. MIMEASSOCIATIONDIALOG_IN_FLAGS;
  316.  
  317. //
  318. //   MIMEAssociationDialog().  Invokes the unregistered MIME content
  319. //  type dialog box.
  320. //
  321. //   This function does not perform any validation on the syntax of the
  322. //  input content type string.  A successful return value does not indicate
  323. //  that the input MIME content type string is a valid content type.
  324. //
  325. //   The function returns S_OK if the MIME content type is associated
  326. //  with the extension.  The extension is associated as the default
  327. //  extension for the content type.  S_FALSE is returned if nothing is
  328. //  registered.  Otherwise, the function returns one of the following
  329. //  errors:
  330. //
  331. //  E_ABORT -- The user cancelled the operation.
  332. //  E_FLAGS -- The flag combination passed in dwFlags is invalid.
  333. //  E_OUTOFMEMORY -- Not enough memory to complete the operation.
  334. //  E_POINTER -- One of the input pointers is invalid.
  335. //
  336. //  Parameters:
  337. //   hwndParent -- A handle to the window to be used as the parent
  338. //                 window of any posted child windows.
  339. //   dwInFlags -- A bit field of MIMEASSOCIATIONDIALOG_IN_FLAGS.  The
  340. //                flags are:
  341. //
  342. //              MIMEASSOCDLG_FL_REGISTER_ASSOC: If set, the application
  343. //               selected is to be registered as the handler for files of
  344. //               the given MIME type.  If clear, no association is to be
  345. //               registered.  An application is only registered if this
  346. //               flag is set, and the user indicates that a persistent
  347. //               association is to be made.  Registration is only possible
  348. //               if pcszFile contains an extension.
  349. //
  350. //   pcszFile -- A pointer to a string indicating the name of the file
  351. //               containing data of pcszMIMEContentType's content type.
  352. //   pcszMIMEContentType -- A pointer to a string indicating the content
  353. //                          type for which an application is sought.
  354. //   pszAppBuf -- A buffer to be filled in on success with the path of
  355. //                the application selected by the user.  pszAppBuf's buffer
  356. //                is filled in with the empty string on failure.
  357. //   ucAppBufLen -- The length of pszAppBuf's buffer in characters.
  358. //
  359.  
  360. INTSHCUTAPI HRESULT WINAPI MIMEAssociationDialogA(HWND hwndParent,
  361.                                                   DWORD dwInFlags,
  362.                                                   PCSTR pcszFile,
  363.                                                   PCSTR pcszMIMEContentType,
  364.                                                   PSTR pszAppBuf,
  365.                                                   UINT ucAppBufLen);
  366. INTSHCUTAPI HRESULT WINAPI MIMEAssociationDialogW(HWND hwndParent,
  367.                                                   DWORD dwInFlags,
  368.                                                   PCWSTR pcszFile,
  369.                                                   PCWSTR pcszMIMEContentType,
  370.                                                   PWSTR pszAppBuf,
  371.                                                   UINT ucAppBufLen);
  372. #ifdef UNICODE
  373. #define MIMEAssociationDialog    MIMEAssociationDialogW
  374. #else
  375. #define MIMEAssociationDialog    MIMEAssociationDialogA
  376. #endif  /* UNICODE */
  377.  
  378. //
  379. //   InetIsOffline().  This function determines if the user wants to be
  380. //  "offline" (get all information from the cache).  The dwFlags must be
  381. //  0.
  382. //
  383. //   The function returns TRUE to indicate that the local system is not
  384. //  currently connected to the Internet.  The function returns FALSE to
  385. //  indicate that either the local system is connected to the Internet,
  386. //  or no attempt has yet been made to connect the local system to the
  387. //  Internet.  Applications that wish to support an off-line mode should
  388. //  do so if InetIsOffline() returns TRUE.
  389. //
  390. //   Off-line mode begins when the user has been prompted to dial-in to
  391. //  an Internet providor, but canceled the attempt.
  392. //
  393. INTSHCUTAPI
  394. BOOL
  395. WINAPI
  396. InetIsOffline(
  397.     DWORD dwFlags);
  398.  
  399. #ifdef __cplusplus
  400. }                                   /* End of extern "C" {. */
  401. #endif   /* __cplusplus */
  402.  
  403. #endif   /* ! __INTSHCUT_H__ */
  404.  
  405.