Export (0) Print
Expand All

Internet Shortcuts

The Internet shortcut object is used to create desktop shortcuts to Internet sites. Like shortcuts to items in the file system, Internet shortcuts take the form of an icon on the desktop. When the user clicks the icon, the browser is launched and displays the site associated with the shortcut.

The following topics are discussed.

Creating Internet Shortcuts

You can create an Internet shortcut by using a WebBrowser control or with the URL of the page.

Creating an Internet Shortcut from a WebBrowser Control

If your application hosts a WebBrowser control, you can use the Internet shortcut object to create shortcuts in the following way.

  1. Create an instance of the Internet shortcut object with CoCreateInstance, using a class identifier (CLSID) of CLSID_InternetShortcut.
  2. Pass the pointer to the WebBrowser's IUnknown interface to the Internet shortcut object with IObjectWithSite::SetSite.
  3. Call the Internet shortcut object's IPersistFile::Save method when you want to create a shortcut to the page being viewed by the WebBrowser control.

A shortcut will be created in the location specified in IPersistFile::Save. This location enables the WebBrowser control to restore its state, which includes the task of loading of the correct documents into framesets.

Creating an Internet Shortcut from a URL

You can also create an Internet shortcut if you have the URL of the page to which you want to link.

  1. Create an instance of the Internet shortcut object with CoCreateInstance, using a CLSID of CLSID_InternetShortcut.
  2. Use the IUniformResourceLocator::SetURL method to set the URL in the shortcut.
  3. Use the IPersistFile::Save method to save the shortcut file to a desired location.

Accessing Property Storage

The Internet shortcut object contains several properties that you can access through the object's IPropertySetStorage interface with the following procedure.

  1. Get the IPropertySetStorage interface by calling QueryInterface with IID_IPropertySetStorage.
  2. Access the Internet shortcut property storage set by calling IPropertySetStorage::Open with FMTID_Intshcut or FMTID_InternetSite to obtain the IPropertyStorage interface.
  3. Read the property storage information with IPropertyStorage::ReadMultiple by passing the appropriate property ID.

With version 4.70 or higher of Shell32.dll, you can also retrieve the IPropertySetStorage interface by calling IShellFolder::BindToStorage with the pidl parameter set to the .URL file and the riid parameter set to IID_IPropertySetStorage.

The following property IDs can be requested for FMTID_Intshcut.

PROPIDVariant TypeDescription
PID_IS_URLVT_LPWSTRURL to which the shortcut leads
PID_IS_NAMEVT_LPWSTRName of the Internet shortcut
PID_IS_WORKINGDIRVT_LPWSTRWorking directory for the shortcut
PID_IS_HOTKEYVT_UI2Hotkey for the shortcut
PID_IS_SHOWCMDVT_I4Show command for shortcut
PID_IS_ICONINDEXVT_I4Index of the icon
PID_IS_ICONFILEVT_LPWSTRFile that contains the icon
PID_IS_WHATSNEWVT_LPWSTRWhat's New text
PID_IS_AUTHORVT_LPWSTRAuthor
PID_IS_DESCRIPTIONVT_LPWSTRDescription text of site
PID_IS_COMMENTVT_LPWSTRUser annotated comment
PID_IS_ROAMEDVT_BOOL True when shortcut is roamed for first time

 

The following property IDs can be requested for FMTID_InternetSite.

PROPIDVariant TypeDescription
PID_INTSITE_WHATSNEWVT_LPWSTRWhat's New text
PID_INTSITE_AUTHORVT_LPWSTRAuthor
PID_INTSITE_LASTVISITVT_FILETIMETime site was last visited
PID_INTSITE_LASTMODVT_FILETIMETime site was last modified
PID_INTSITE_VISITCOUNTVT_UI4Number of times user has visited
PID_INTSITE_DESCRIPTIONVT_LPWSTRDescription text of site
PID_INTSITE_COMMENTVT_LPWSTRUser annotated comment
PID_INTSITE_FLAGSVT_UI4Indicates use of PIDISF_ flags (see below)
PID_INTSITE_CONTENTLENN/ANot currently supported
PID_INTSITE_CONTENTCODEN/ANot currently supported
PID_INTSITE_RECURSEN/ANot currently supported
PID_INTSITE_WATCHN/ANot currently supported
PID_INTSITE_SUBSCRIPTIONVT_UI8SUBSCRIPTIONCOOKIE value for subscription manager
PID_INTSITE_URLVT_LPWSTRURL to which the shortcut leads
PID_INTSITE_TITLEVT_LPWSTRTitle
PID_INTSITE_CODEPAGEVT_UI4Codepage of the document
PID_INTSITE_TRACKINGN/ANot currently supported
PID_INTSITE_ICONINDEXVT_I4Index of the icon
PID_INTSITE_ICONFILEVT_LPWSTRFile that contains the icon
PID_INTSITE_ROAMEDVT_UI4The entry was added due to roaming

 

The following are the Internet site flags.

FlagDescription
PIDISF_RECENTLYCHANGEDIndicates that a site was recently changed
PIDISF_CACHEDSTICKYNot currently supported
PIDISF_CACHEIMAGESNot currently supported
PIDISF_FOLLOWALLLINKSNot currently supported

 

The following values are used for Internet roaming history.

Value of PID_INTSITE_ROAMEDDescription
Value not set or PIDISR_UP_TO_DATEThis cache entry has not been modified by roaming.
PIDISR_NEEDS_ADDThis cache entry was added to the cache by roaming. Set PIDISR_UP_TO_DATE once processing of the entry is complete.
PIDISR_NEEDS_UPDATEThis cache entry already existed on the local machine, but it was updated by roaming. Set PIDISR_UP_TO_DATE once processing of the entry is complete.
PIDISR_NEEDS_DELETERoaming detected that this cache entry should be deleted. For example, the user may have cleared his or her browser history. Delete the entry using DeleteUrlCacheEntry.

 

Interfaces

The Internet shortcut object exposes a number of interfaces.

OLE interfaces

Shell interfaces

Functions

There are several utility functions that can be used with the Internet shortcut object.

Internet shortcut utility functions

 

 

Build date: 7/12/2013

Community Additions

ADD
Show:
© 2014 Microsoft