Home COM GDI+ WebBrowser Data Access

IActiveDesktop Interface

 

CLSID_ActiveDesktop

{75048700-EF1F-11D0-9888-006097DEACF9}

IID_IActiveDesktop

{F490EB00-1240-11D1-9888-006097DEACF9}

 

 

Allows a client program to manage the desktop items and wallpaper on a local computer.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IActiveDesktop Methods

Description

ApplyChanges

Applies changes to the Active Desktop and saves them in the registry.

GetWallpaper

Retrieves the wallpaper currently being used.

SetWallpaper

Sets the wallpaper for the Active Desktop.

GetWallpaperOptions

Retrieves the wallpaper options.

SetWallpaperOptions

Sets the wallpaper options.

GetPattern

Retrieves the pattern currently being used.

SetPattern

Sets the Active Desktop pattern.

GetDesktopItemOptions

Retrieves the desktop item's options.

SetDesktopItemOptions

Sets the item's options.

AddDesktopItem

Adds a desktop item.

AddDesktopItemWithUI

Adds a desktop item to the Active Desktop after displaying user interfaces that confirm the addition of the desktop item, verify security zone permissions, and ask if the user wants to create a subscription.

ModifyDesktopItem

Modifies the desktop item.

RemoveDesktopItem

Removes the specified desktop item from the desktop.

GetDesktopItemCount

Retrieves a count of the desktop items.

GetDesktopItem

Retrieves the specified desktop item.

GetDesktopItemByID

Retrieves the desktop item that matches the given identification.

GenerateDesktopItemHtml

Generates a generic HTML page containing the given desktop item.

AddUrl

Adds the desktop item associated with the specified URL.

GetDesktopItemBySource

Retrieves a desktop item using its source URL.

 

Wrapper to create an instance of Active Desktop

 

FUNCTION IActiveDesktop_CreateInstance (BYREF ppActiveDesktop AS DWORD) AS LONG

   LOCAL CLSID_ActiveDesktop AS GUID
   LOCAL IID_ActiveDesktop AS GUID

   CLSID_ActiveDesktop = GUID$("{75048700-EF1F-11D0-9888-006097DEACF9}")
   IID_ActiveDesktop = GUID$("{F490EB00-1240-11D1-9888-006097DEACF9}")
   FUNCTION = CoCreateInstance(CLSID_ActiveDesktop, BYVAL %NULL, %CLSCTX_INPROC_SERVER, IID_ActiveDesktop, ppActiveDesktop)

END FUNCTION

 

 

ApplyChanges

 

FUNCTION IActiveDesktop_ApplyChanges ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL dwFlags AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IActiveDesktop_ApplyChanges (pthis, dwFlags) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

GetWallpaper

 

DECLARE FUNCTION Proto_IActiveDesktop_GetWallpaper ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwszWallpaper AS DWORD _

, BYVAL cchWallpaper AS DWORD _

, BYVAL dwReserved AS DWORD _

  ) AS LONG
 

FUNCTION IActiveDesktop_GetWallpaper ( _

  BYVAL pthis AS DWORD PTR _

, BYREF strWallpaper AS STRING _

  ) AS LONG

  LOCAL HRESULT AS LONG
  LOCAL wszWallpaper AS ASCIIZ * (%MAX_PATH * 2)
  LOCAL wstrLen AS LONG
  strWallpaper = ""
  CALL DWORD @@pthis[4] USING Proto_IActiveDesktop_GetWallpaper (pthis, VARPTR(wszWallpaper), SIZEOF(wszWallpaper), 0) TO HRESULT
  IF HRESULT = %S_OK THEN
     wstrLen = lstrlenW(wszWallpaper)
     IF wstrlen THEN strWallpaper = ACODE$(PEEK$(VARPTR(wszWallpaper), wstrlen * 2))
  END IF
  FUNCTION = HRESULT

END FUNCTION

 

 

SetWallpaper

 

FUNCTION IActiveDesktop_SetWallpaper ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL strWallpaper AS STRING _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  strWallpaper = UCODE$(strWallpaper & $NUL)
  CALL DWORD @@pthis[5] USING IActiveDesktop_SetWallpaper (pthis, strWallpaper, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

Sample code to change the wallpaper (remember to change the path)

 

LOCAL hr AS LONG

LOCAL ppActiveDesktop AS DWORD

 

' Create an instance of the Active Desktop

hr = IActiveDesktop_CreateInstance(ppActiveDesktop)

' Set the wallpaper

hr = IActiveDesktop_SetWallpaper(ppActiveDesktop, "D:\Documents and Settings\-Pepe-\Configuración local\Datos de Programa\Microsoft\Wallpaper1.bmp")
' Apply the changes

hr = IActiveDesktop_ApplyChanges(ppActiveDesktop, %AD_APPLY_ALL)

' Release the Active Desktop interface

IUnknown_Release ppActiveDesktop
 

 

GetWallpaperOptions

 

FUNCTION IActiveDesktop_GetWallpaperOptions ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pwpo AS WALLPAPEROPT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pwpo.dwSize <> SIZEOF(WALLPAPEROPT) THEN pwpo.dwSize = SIZEOF(WALLPAPEROPT)
  CALL DWORD @@pthis[6] USING IActiveDesktop_GetWallpaperOptions (pthis, pwpo, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

SetWallpaperOptions

 

FUNCTION IActiveDesktop_SetWallpaperOptions ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pwpo AS WALLPAPEROPT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IActiveDesktop_SetWallpaperOptions (pthis, pwpo, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetPattern

 

DECLARE FUNCTION Proto_IActiveDesktop_GetPattern ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pwszPattern AS DWORD _

, BYVAL cchPattern AS DWORD _

, BYVAL dwReserved AS DWORD _

  ) AS LONG
 

FUNCTION IActiveDesktop_GetPattern ( _

  BYVAL pthis AS DWORD PTR _

, BYREF strPattern AS STRING _

  ) AS LONG

  LOCAL HRESULT AS LONG
  LOCAL wszPattern AS ASCIIZ * 8 * 2
  LOCAL wstrLen AS LONG
  strPattern = ""
  CALL DWORD @@pthis[8] USING Proto_IActiveDesktop_GetPattern (pthis, VARPTR(wszPattern), SIZEOF(wszPattern), 0) TO HRESULT
  IF HRESULT = %S_OK THEN
     wstrLen = lstrlenW(wszPattern)
     IF wstrlen THEN strPattern = ACODE$(PEEK$(VARPTR(wszPattern), wstrlen * 2))
  END IF
  FUNCTION = HRESULT

END FUNCTION

 

 

SetPattern

 

FUNCTION IActiveDesktop_SetPattern ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL strPattern AS STRING _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  strPattern = UCODE$(strPattern & $NUL)
  CALL DWORD @@pthis[9] USING IActiveDesktop_SetPattern (pthis, strPattern, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

GetDesktopItemOptions

 

FUNCTION IActiveDesktop_GetDesktopItemOptions ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pco AS COMPONENTSOPT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pco.dwSize <> SIZEOF(COMPONENTSOPT) THEN pco.dwSize = SIZEOF(COMPONENTSOPT)
  CALL DWORD @@pthis[10] USING IActiveDesktop_GetDesktopItemOptions (pthis, pco, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

SetDesktopItemOptions

 

FUNCTION IActiveDesktop_SetDesktopItemOptions ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pco AS COMPONENTSOPT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pco.dwSize <> SIZEOF(COMPONENTSOPT) THEN pco.dwSize = SIZEOF(COMPONENTSOPT)
  CALL DWORD @@pthis[11] USING IActiveDesktop_SetDesktopItemOptions (pthis, pco, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

AddDesktopItem

 

FUNCTION IActiveDesktop_AddDesktopItem ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[12] USING IActiveDesktop_AddDesktopItem (pthis, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

AddDesktopItemWithUI

 

FUNCTION IActiveDesktop_AddDesktopItemWithUI ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL hwnd AS DWORD _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[13] USING IActiveDesktop_AddDesktopItemWithUI (pthis, hwnd, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

ModifyDesktopItem

 

FUNCTION IActiveDesktop_ModifyDesktopItem ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pcomp AS COMPONENT _

, BYVAL dwFlags AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[14] USING IActiveDesktop_ModifyDesktopItem (pthis, pcomp, dwFlags) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

RemoveDesktopItem

 

FUNCTION IActiveDesktop_RemoveDesktopItem ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[15] USING IActiveDesktop_RemoveDesktopItem (pthis, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

GetDesktopItemCount

 

FUNCTION IActiveDesktop_GetDesktopItemCount ( _

  BYVAL pthis AS DWORD PTR _

, BYREF lpiCount AS LONG _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[16] USING IActiveDesktop_GetDesktopItemCount (pthis, lpiCount, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetDesktopItem

 

FUNCTION IActiveDesktop_GetDesktopItem ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL nComponent AS LONG _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[17] USING IActiveDesktop_GetDesktopItem (pthis, nComponent, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetDesktopItemById

 

FUNCTION IActiveDesktop_GetDesktopItemByID ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL dwID AS DWORD _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[18] USING IActiveDesktop_GetDesktopItemByID (pthis, dwID, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GenerateDesktopItemHtml

 

FUNCTION IActiveDesktop_GenerateDesktopItemHtml ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL strFileName AS STRING _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  strFileName = UCODE$(strFileName & $NUL)
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[19] USING IActiveDesktop_GenerateDesktopItemHtml (pthis, strFileName, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT
 

END FUNCTION

 

 

AddUrl

 

FUNCTION IActiveDesktop_AddUrl ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL hwnd AS DWORD _

, BYVAL strSource AS STRING _

, BYREF pcomp AS COMPONENT _

, BYVAL dwFlags AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  strSource = UCODE$(strSource & $NUL)
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[20] USING IActiveDesktop_AddUrl (pthis, hwnd, strSource, pcomp, dwFlags) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetDesktopItemBySource

 

FUNCTION IActiveDesktop_GetDesktopItemBySource ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL strSource AS STRING _

, BYREF pcomp AS COMPONENT _

, OPTIONAL BYVAL dwReserved AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  strSource = UCODE$(strSource & $NUL)
  IF pcomp.dwSize <> SIZEOF(COMPONENT) THEN pcomp.dwSize = SIZEOF(COMPONENT)
  CALL DWORD @@pthis[21] USING IActiveDesktop_GetDesktopItemBySource (pthis, strSource, pcomp, dwReserved) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Page last updated on Sunday, 30 April 2006 14:25:59 +0200