## Internet Shortcut Global Functions

This section contains information about the following Internet Shortcut global functions:

- InetIsOffline
- MIMEAssociationDialog
- TranslateURL
- URLAssociationDialog

### InetIsOffline

    BOOL InetIsOffline (
        DWORD dwFlags
    );

Determines whether the system is connected to the Internet.

- Returns TRUE if the local system in not currently connected to the Internet. Returns FALSE if the local system is connected to the Internet or if no attempt has yet been made to connect to the Internet.

dwFlags
  Input flags for the function. This must be set to zero.

### MIMEAssociationDialog

    HRESULT WINAPI MIMEAssociationDialog (
        HWND    hwndParent,
        DWORD   dwInFlags,
        LPCSTR  pcszFile,
        LPCSTR  pcszMIMEContentType,
        LPSTR   pszAppBuf,
        UINT    ucAppBufLen
    );

Runs the unregistered MIME content type dialog box.

- Returns S_OK if the content type was successfully associated with the extension. In this case, the extension is associated as the default for the content type, and pszAppBuf points to the string that contains the path of the specified application. The function returns S_FALSE if nothing was registered. Otherwise, the return value will be one of the following:

  Value | Meaning
  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.

hwndParent
  Handle to the parent window of any posted child windows.
dwInFlags
  Bit flag value that specifies if an association is to be registered. The bit flag is the value MIMEASSOCDLG_FL_REGISTER_ASSOC (0x0001). If this bit is set, the selected application is registered as the handler for the given MIME type. If this bit is clear, no association is registered.

  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.

pcszFile
  Pointer to a null-terminated string that contains the name of the target file. This file must conform to the content type described by the pcszMIMEContentType parameter.
pcszMIMEContentType
  Pointer to a null-terminated string that contains the unregistered content type.
pszAppBuf
  Pointer to a buffer that receives the path of the application specified by the user.
ucAppBufLen
  Size of pszAppBuf, in characters.

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.

### TranslateURL

    HRESULT WINAPI TranslateURL(
        LPCSTR pcszURL,
        DWORD dwInFlags,
        LPSTR *ppszTranslatedURL
    );

Applies common translations to a given URL string, creating a new URL string.

- Returns S_OK upon success, or S_FALSE if the URL did not require translation. If an error occurs, the function returns one of the following values:

  Value | Meaning
  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.

pcszURL
  Pointer to the URL string to be translated.
dwInFlags
  Bit flags that specify how the URL string is to be translated. This value can be a combination of the following:
  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.
ppszTranslatedURL
  Pointer variable that receives the pointer to the newly created, translated URL string, if any. *ppszTranslatedURL is valid only if the function returns S_OK.

This function does not validate the input URL string. A successful return value does not indicate that the URL strings are valid URLs.

### URLAssociationDialog

    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.

- Returns S_OK if the application is registered with the URL protocol, or S_FALSE if nothing is registered. For example, the function returns S_FALSE when the user elects to perform a one-time execution via the selected application.

hwndParent
  Handle to the parent window.
dwInFlags
  Bit flags that specify the behavior of the function. This value can be a combination of the following:
  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.
pcszFile
  Pointer to a const zero-terminated string that contains the file name to associate with the URL's protocol.
pcszURL
  Pointer to a const zero-terminated string that contains the URL with an unknown protocol.
pszAppBuf
  Pointer to a buffer that receives the path of the application specified by the user.
ucAppBufLen
  The size of pszAppBuf, in characters.

© 1996 Microsoft Corporation