
This topic explains the Internet Shortcuts API for managing "shortcuts" to URL locations.
IUniformResourceLocator Interface
Internet Shortcut Global Functions
Internet Shortcut Enumerated Types
This section provides information about the following IUniformResourceLocator interface methods:
HRESULT GetURL(
LPSTR *ppszURL
);
Retrieves an object's uniform resource locator (URL).
| E_OUTOFMEMORY | There is not enough memory to complete the operation. |
| IS_E_EXEC_FAILED | The URL's protocol handler failed to run. |
| URL_E_INVALID_SYNTAX | The URL's syntax is invalid. |
| URL_E_UNREGISTERED_PROTOCOL | The URL's protocol does not have a registered protocol handler. |
// START CODE FRAGMENT
{
// In this example, pURL is a global IUniformResourceLocator pointer.
LPSTR lpTemp;
hres = pURL->GetURL(&lpTemp);
if (SUCCEEDED(hres)){
IMalloc* pMalloc;
hres = SHGetMalloc(&pMalloc);
if (SUCCEEDED(hres)){
pMalloc->Free(lpTemp);
pMalloc->Release();
}
}
}
// END CODE FRAGMENT
HRESULT InvokeCommand(
PURLINVOKECOMMANDINFO pURLCommandInfo;
);
Runs a command on an object's URL.
| E_OUTOFMEMORY | There is not enough memory to complete the operation. |
| IS_E_EXEC_FAILED | The URL's protocol handler failed to run. |
| URL_E_INVALID_SYNTAX | The URL's syntax is invalid. |
| URL_E_UNREGISTERED_PROTOCOL | The URL's protocol does not have a registered protocol handler. |
HRESULT SetURL(
LPCSTR pcszURL,
DWORD dwInFlags
);
Sets an object's URL.
| E_OUTOFMEMORY | There is not enough memory to complete the operation. |
| IS_E_EXEC_FAILED | The URL's protocol handler failed to run. |
| URL_E_INVALID_SYNTAX | The URL's syntax is invalid. |
| URL_E_UNREGISTERED_PROTOCOL | The URL's protocol does not have a registered protocol handler. |
| IURL_SETURL_FL_GUESS_PROTOCOL | If the protocol scheme is not specified in pcszURL, the system automatically chooses a scheme and adds it to the URL. |
| IURL_SETURL_FL_USE_DEFAULT_PROTOCOL | If the protocol scheme is not specified in pcszURL, the system adds the default protocol scheme to the URL. |
This section contains information about the following Internet Shortcut global functions:
BOOL InetIsOffline (
DWORD dwFlags
);
Determines whether the system is connected to the Internet.
HRESULT WINAPI MIMEAssociationDialog (
HWND hwndParent,
DWORD dwInFlags,
LPCSTR pcszFile,
LPCSTR pcszMIMEContentType,
LPSTR pszAppBuf,
UINT ucAppBufLen
);
Runs the unregistered MIME content type dialog box.
| E_ABORT | The user canceled the operation. |
| E_FLAGS | The flag combination passed in dwInFlags is invalid. |
| E_OUTOFMEMORY | There was insufficient memory available to complete the operation. |
| E_POINTER | One of the input pointers is invalid. |
An application is registered only if this flag is set and the user indicates that a persistent association is to be made.
Registration is impossible if the string at pcszFile does not contain an extension.
Note This function does not validate the syntax of the input content type string at pcszMIMEContentType. A successful return value does not indicate that the specified MIME content type is valid.
HRESULT WINAPI TranslateURL(
LPCSTR pcszURL,
DWORD dwInFlags,
LPSTR *ppszTranslatedURL
);
Applies common translations to a given URL string, creating a new URL string.
| E_FLAGS | The flag combination passed in dwInFlags is invalid. |
| E_OUTOFMEMORY | There was insufficient memory to complete the operation. |
| E_POINTER | One of the input pointers is invalid. |
| TRANSLATEURL_FL_GUESS_PROTOCOL | If the protocol scheme is not specified in the pcszURL parameter to TranslateURL, the system automatically chooses a scheme and adds it to the URL. |
| TRANSLATEURL_FL_USE_DEFAULT_PROTOCOL | If the protocol scheme is not specified in the pcszURL parameter to TranslateURL, the system adds the default protocol to the URL. |
This function does not validate the input URL string. A successful return value does not indicate that the URL strings are valid URLs.
HRESULT WINAPI URLAssociationDialog(
HWND hwndParent,
DWORD dwInFlags,
LPCSTR pcszFile,
LPCSTR pcszURL,
LPSTR pszAppBuf,
UINT ucAppBufLen
);
Invokes the unregistered URL protocol dialog box. This dialog box allows the user to select an application to associate with a previously unknown protocol.
| URLASSOCDLG_FL_USE_DEFAULT_NAME | Use the default file name (that is, "Internet Shortcut"). |
| URLASSOCDLG_FL_REGISTER_ASSOC | Register the selected application as the handler for the protocol specified in pcszURL. The application is registered only if this flag is set and the user indicates that a persistent association is desired. |
This section contains information on the following Internet Shortcut enumerated types:
typedef enum iurl_seturl_flags{
IURL_SETURL_FL_GUESS_PROTOCOL = 0x0001,
IURL_SETURL_FL_USE_DEFAULT_PROTOCOL = 0x0002
} IURL_SETURL_FLAGS;
The following enumerated values are used with the IUniformResourceLocator::SetURL method. They are passed in as the dwInFlags parameter.
typedef enum iurl_invokecommand_flags{
IURL_INVOKECOMMAND_FL_ALLOW_UI = 0x0001,
IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB = 0x0002,
} IURL_INVOKECOMMAND_FLAGS;
The following enumerated values are used in the dwFlags member of the URLINVOKECOMMANDINFO structure.
typedef enum mimeassociationdialog_in_flags{
MIMEASSOCDLG_FL_REGISTER_ASSOC = 0x0001
} MIMEASSOCIATIONDIALOG_IN_FLAGS;
The following enumerated value is used with the MIMEAssociationDialog function to determine how it executes.
An application is registered only if this flag is set and the user indicates that a persistent association is to be made.
typedef enum translateurl_in_flags {
TRANSLATEURL_FL_GUESS_PROTOCOL = 0x0001,
TRANSLATEURL_FL_USE_DEFAULT_PROTOCOL = 0x0002,
} TRANSLATEURL_IN_FLAGS;
The following enumerated values are used with the TranslateURL function to determine how it will execute.
typedef enum urlassociationdialog_in_flags {
URLASSOCDLG_FL_USE_DEFAULT_NAME = 0x0001,
URLASSOCDLG_FL_REGISTER_ASSOC = 0x0002
} URLASSOCIATIONDIALOG_IN_FLAGS;
The following enumerated values are used with the URLAssociationDialog function to determine how it executes.
This section provides information about the following Internet Shortcut structure:
typedef struct {
DWORD dwcbSize;
DWORD dwFlags;
HWND hwndParent;
LPCSTR pcszVerb;
} URLINVOKECOMMANDINFO, *PURLINVOKECOMMANDINFO;
Contains information for use with the IUniformResourceLocator::InvokeCommand method.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.