intshcut.h
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 15k
Category:

Windows Develop

Development Platform:

Visual C++

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