WallPaper

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi ,

I would like to get access to the Desktop object of run procedure
Refresh (of course if such exists:) ) - at least I can do it my PC
when I click right mouse's botton on the Desktop.

The problem is : the Wallpaper file changes by program from time to
time, but not refreshed. I am going to do it from the problem.

If you have any idea how to do it - please let me know .

Thanks.
 
Mike said:
Hi ,

I would like to get access to the Desktop object of run procedure
Refresh (of course if such exists:) ) - at least I can do it my PC
when I click right mouse's botton on the Desktop.

The problem is : the Wallpaper file changes by program from time to
time, but not refreshed. I am going to do it from the problem.

If you have any idea how to do it - please let me know .

Thanks.

Hi Mike,

you can use the following custom COM-Wrapper to get a reference to the
IActiveDesktop interface and call SetWallpaper afterwards. The Desktop
will refresh automatically then.

Imports System
Imports System.Runtime.InteropServices

Public Enum WPSTYLE
CENTER = 0
TILE = 1
STRETCH = 2
MAX = 3
End Enum

Public Structure WALLPAPEROPT
Public dwSize As Integer
Public dwStyle As WPSTYLE
End Structure

Public Structure COMPONENTSOPT
Public dwSize As Integer
<MarshalAs(UnmanagedType.Bool)> _
Public fEnableComponents As Boolean
<MarshalAs(UnmanagedType.Bool)> _
Public fActiveDesktop As Boolean
End Structure

Public Structure COMPPOS
Public Const COMPONENT_TOP As Integer = &H3FFFFFFF
Public Const COMPONENT_DEFAULT_LEFT As Integer = &HFFFF
Public Const COMPONENT_DEFAULT_TOP As Integer = &HFFFF

Public dwSize As Integer
Public iLeft As Integer
Public iTop As Integer
Public dwWidth As Integer
Public dwHeight As Integer
Public izIndex As Integer
<MarshalAs(UnmanagedType.Bool)> _
Public fCanResize As Boolean
<MarshalAs(UnmanagedType.Bool)> _
Public fCanResizeX As Boolean
<MarshalAs(UnmanagedType.Bool)> _
Public fCanResizeY As Boolean
Public iPreferredLeftPercent As Integer
Public iPreferredTopPercent As Integer
End Structure

<Flags()> _
Public Enum ITEMSTATE
NORMAL = &H1
FULLSCREEN = &H2
SPLIT = &H4
VALIDSIZESTATEBITS = NORMAL Or SPLIT Or FULLSCREEN
VALIDSTATEBITS = NORMAL Or SPLIT Or FULLSCREEN Or &H80000000 Or
&H40000000
End Enum

Public Structure COMPSTATEINFO
Public dwSize As Integer
Public iLeft As Integer
Public iTop As Integer
Public dwWidth As Integer
Public dwHeight As Integer
Public dwItemState As Integer
End Structure

Public Enum COMP_TYPE
HTMLDOC = 0
PICTURE = 1
WEBSITE = 2
CONTROL = 3
CFHTML = 4
MAX = 4
End Enum

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Structure COMPONENT
Private Const INTERNET_MAX_URL_LENGTH As Integer = 2084
Public dwSize As Integer
Public dwID As Integer
Public iComponentType As COMP_TYPE
<MarshalAs(UnmanagedType.Bool)> _
Public fChecked As Boolean
<MarshalAs(UnmanagedType.Bool)> _
Public fDirty As Boolean
<MarshalAs(UnmanagedType.Bool)> _
Public fNoScroll As Boolean
Public cpPos As COMPPOS
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
Public wszFriendlyName As String
<MarshalAs(UnmanagedType.ByValTStr,
SizeConst:=INTERNET_MAX_URL_LENGTH)> _
Public wszSource As String
<MarshalAs(UnmanagedType.ByValTStr,
SizeConst:=INTERNET_MAX_URL_LENGTH)> _
Public wszSubscribedURL As String
#If AD_IE5 Then
public dwCurItemState as Integer
public csiOriginal as COMPSTATEINFO
public csiRestored as COMPSTATEINFO
#End If
End Structure

Public Enum DTI_ADTIWUI
DTI_ADDUI_DEFAULT = &H0
DTI_ADDUI_DISPSUBWIZARD = &H1
DTI_ADDUI_POSITIONITEM = &H2
End Enum

<Flags()> _
Public Enum AD_APPLY
SAVE = &H1
HTMLGEN = &H2
REFRESH = &H4
ALL = SAVE Or HTMLGEN Or REFRESH
FORCE = &H8
BUFFERED_REFRESH = &H10
DYNAMICREFRESH = &H20
End Enum
<Flags()> _
Public Enum COMP_ELEM
TYPE = &H1
CHECKED = &H2
DIRTY = &H4
NOSCROLL = &H8
POS_LEFT = &H10
POS_TOP = &H20
SIZE_WIDTH = &H40
SIZE_HEIGHT = &H80
POS_ZINDEX = &H100
SOURCE = &H200
FRIENDLYNAME = &H400
SUBSCRIBEDURL = &H800
ORIGINAL_CSI = &H1000
RESTORED_CSI = &H2000
CURITEMSTATE = &H4000
ALL = TYPE Or CHECKED Or DIRTY _
Or NOSCROLL Or POS_LEFT Or SIZE_WIDTH _
Or SIZE_HEIGHT Or POS_ZINDEX _
Or SOURCE Or FRIENDLYNAME Or POS_TOP _
Or SUBSCRIBEDURL Or ORIGINAL_CSI Or _
RESTORED_CSI Or CURITEMSTATE
End Enum

<Flags()> _
Public Enum ADDURL
SILENT = &H1
End Enum

<ComImport(), _
Guid("F490EB00-1240-11D1-9888-006097DEACF9"), _
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Interface IActiveDesktop
Sub ApplyChanges(ByVal dwFlags As AD_APPLY)

Sub GetWallpaper( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pwszWallpaper As System.Text.StringBuilder, _
ByVal cchWallpaper As Integer, _
ByVal dwReserved As Integer)

Sub SetWallpaper( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pwszWallpaper As String, _
ByVal dwReserved As Integer)

Sub GetWallpaperOptions( _
ByRef pwpo As WALLPAPEROPT, _
ByVal dwReserved As Integer)

Sub SetWallpaperOptions( _
<System.Runtime.InteropServices.In()> _
ByRef pwpo As WALLPAPEROPT, _
ByVal dwReserved As Integer)

Sub GetPattern( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pwszPattern As System.Text.StringBuilder, _
ByVal cchPattern As Integer, _
ByVal dwReserved As Integer)

Sub SetPattern( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pwszPattern As String, _
ByVal dwReserved As Integer)

Sub GetDesktopItemOptions( _
ByRef pco As COMPONENTSOPT, _
ByVal dwReserved As Integer)

Sub SetDesktopItemOptions( _
<System.Runtime.InteropServices.In()> _
ByRef pco As COMPONENTSOPT, _
ByVal dwReserved As Integer)

Sub AddDesktopItem( _
<System.Runtime.InteropServices.In()> _
ByRef pcomp As COMPONENT, _
ByVal dwReserved As Integer)

Sub AddDesktopItemWithUI( _
ByVal hwnd As IntPtr, _
<System.Runtime.InteropServices.In()> _
ByRef pcomp As COMPONENT, _
ByVal dwFlags As DTI_ADTIWUI)

Sub ModifyDesktopItem( _
<System.Runtime.InteropServices.In()> _
ByRef pcomp As COMPONENT, _
ByVal dwFlags As COMP_ELEM)

Sub RemoveDesktopItem( _
<System.Runtime.InteropServices.In()> _
ByRef pcomp As COMPONENT, _
ByVal dwReserved As Integer)

Sub GetDesktopItemCount( _
<System.Runtime.InteropServices.Out()> ByVal _
lpiCount As Integer, _
ByVal dwReserved As Integer)

Sub GetDesktopItem( _
ByVal nComponent As Integer, _
ByRef pcomp As COMPONENT, _
ByVal dwReserved As Integer)

Sub GetDesktopItemByID( _
ByVal dwID As IntPtr, _
ByRef pcomp As COMPONENT, _
ByVal dwReserved As Integer)

Sub GenerateDesktopItemHtml( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pwszFileName As String, _
<System.Runtime.InteropServices.In()> _
ByRef pcomp As COMPONENT, _
ByVal dwReserved As Integer)

Sub AddUrl( _
ByVal hwnd As IntPtr, _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pszSource As String, _
<System.Runtime.InteropServices.In()> _
ByRef pcomp As COMPONENT, _
ByVal dwFlags As AddUrl)

Sub GetDesktopItemBySource( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal _
pwszSource As String, _
ByRef pcomp As COMPONENT, _
ByVal dwReserved As Integer)
End Interface

<ComImport(), Guid("F490EB00-1240-11D1-9888-006097DEACF9")> _
Public Class ActiveDesktop
End Class

Cheers

Arne Janning
 
Back
Top