First declare, don't understand VB, don't talk, annoyance. Here is to give you an example. I don't help you write the code, you can use it. Some constant definitions used in Windows32:
Public class_win32
PUBLIC const ad_apply_all asse integer = ad_apply_save or ad_apply_htmlgen or ad_apply_refresh
Public const ad_apply_buffered_refresh as integer = & h10
Public const ad_apply_dynamicrefresh as integer = & h20
Public const ad_Apply_force as integer = & h8
Public const ad_Apply_htmlgen as integer = & h2
Public const ad_Apply_refresh as integer = & h4
Public const ad_apply_save as integer = & h1
Public Const COMP_ELEM_ALL As Integer = COMP_ELEM_TYPE Or COMP_ELEM_CHECKED Or COMP_ELEM_DIRTY Or COMP_ELEM_NOSCROLL Or COMP_ELEM_POS_LEFT Or COMP_ELEM_SIZE_WIDTH Or COMP_ELEM_SIZE_HEIGHT Or COMP_ELEM_POS_ZINDEX Or COMP_ELEM_SOURCE Or COMP_ELEM_FRIENDLYNAME Or COMP_ELEM_POS_TOP Or COMP_ELEM_SUBSCRIBEDURL Or COMP_ELEM_ORIGINAL_CSI Or COMP_ELEM_RESTORED_CSI Or COMP_ELEM_CURITEMSTATE
Public const comp_elex_checked as integer = & h2
Public const comp_elex_curitemstate as integer = & h4000
Public const comp_lem_dirty as integer = & h4
Public const compound_lem_friendlyname as integer = & h400
Public const comp_elex_noscroll as integer = & h8
Public const comp_elex_original_csi as integer = & h1000
Public const comp_lem_pos_left as integer = & h10
PUBLIC const comp_lem_pos_top as integer = & h20
Public const comp_lem_pos_zindex as integer = & h100
PUBLIC const comp_elex_restored_csi as integer = & h2000
Public const comp_lem_size_height as integer = & h80
Public const comp_lem_size_width as integer = & h40
Public const comp_lem_source as integer = & h200
PUBLIC const comp_lex_type as integer = & h1public const comp_elex_subscribedURL AS INTEGER = & h800
Public const comp_type_control as integer = 3
Public const comp_type_htmldoc as integer = 0
Public const comp_type_picture as integer = 1
Public const comp_type_website as integer = 2
Public const companyT_default_left as integer = & hffff
Public const companyent_default_top as integer = & hffff
Public const is_fullscreen as integer = & h2
Public const IS_NORMAL AS INTEGER = & H1
Public const is_split as integer = & h4
Public const Max_path as integer = 260
Public const wpStyle_center as integer = 0
Public const wpStyle_max as integer = 3
Public const wpStyle_stretch as integer = 2
Public const wpStyle_tile as integer = 1
Public structure_tagcompStateInfo
Private dwsize as in
Private Ileft AS Integer
Private ITOP As INTEGER
Private dwidth as in
Private dwheight as integer
Private dwitemstate as integer
End structure
Public structure_tagcomppos
Private dwsize as in
Private Ileft AS Integer
Private ITOP As INTEGER
Private dwidth as in
Private dwheight as integer
Private Izindex As Integer
Private fcanresize as boolean
Private fcanresizex as boolean
Private fcanResizey as boolean
Private ipreferredleftpercent as in
Private ipreferredtoppercent as integer
End structure
Public structure_tagcomponent
Public DWSIZE AS INTEGERPUBLIC DWID AS INTEGER
Public iComponentType As Integer
Public fChecked as boolean
Public fdirty as boolean
Public Fnoscroll As Boolean
Public cppos as _tagcomppos
Public WSZFRIENDLYNAME AS STRING
Public WSZSource As String
Public WSZSUBSCRIBEDURL AS STRING
Public dwcuritemstate as in
Public csiorIginal as _tagcompStateInfo
Public CSIRESTORED AS _TAGCompStateInfo
End structure
Public structure_tagcomponentsopt
Public DWSIZE AS INTEGER
Public FenableComponents as Boolean
Public FactiveDesktop as Boolean
End structure
Public structure_tagwallpaperopt
Public DWSIZE AS INTEGER
Public DWStyle AS Integer
End structure
END CLASS State IACTIVEDESKTOP object
Public Interface IactiveDesktop
Function ApplyChanges (Byval dwflags as integer) AS INTPTR
Function getWallpaper (
Function setWallpaper (
Function GetWallpaperOptions (ByRef pwpo As _win32._tagWALLPAPEROPT, ByVal dwReserved As Integer) As IntPtrFunction SetWallpaperOptions (<[In] ()> ByRef pwpo As _win32._tagWALLPAPEROPT, ByVal dwReserved As Integer) As IntPtr
Function getPattern (
Function setPattern (UnmanagedType.lpwstr)> Byval Pwszpattern as string, byval dwreserved as integer AS INTPTR
Function getDesktopItemOptions (byref pco as _win32._tagcomponentsopt, byval dwreserved as integer) AS INTPTR
Function setDesktopItemOptions (<[in] ()> BYREF PCOMP AS _WIN32._TAGComponentsopt, byval dwreserved as integer AS INTPTR
Function addesktopItem (<[in] ()> Byref pcomp as _win32._tagcomponent, byval dwreserved as integer AS INTPTR
Function AddDesktopItemwithui (BYVAL HWND AS INTPTR, <[In] ()> BYREF PCOMP AS _WIN32._TAGComponent, Byval dwflags as integer AS INTPTR
Function ModifyDesktopItem (<[in] ()> BYREF PCOMP AS _WIN32._TAGComponent, byval dwflags as integer AS INTPTR
Function RemovedesktopItem (<[in] ()> Byref pcomp as _win32._tagcomponent, byval dwreserved as integer AS INTPTR
Function getDesktopItemcount (byref lpicount as integer, byval dwreserved as integer) AS INTPTR
Function getDesktopItem (byval ncomponent as integer, byref pcomp as _win32._tagcomponent, Byval dwreserved as integer) AS INTPTR
Function getDesktopitembylid (ByVal dwid as intptr, byref pcomp as _win32._tagcomponent, byval dwreserved as integer) AS INTPTR
Function GenerateDesktopItemHtml (
Function getDesktopItemBysource (unmanagedtype.lpwstr)> ByVal pszsource as string, byref pcomp as _win32._tagcomponent, byval dwreserved as integer AS INTPTR
End interface
This object will now be used. Use before use
CoCreateObject is created.
Public Shared Function CocreateInstance (_
Byref classguid as guid, _
Byval Punkouter as Intptr, _
Byval dwclscontext as integer, _
Byref Interfaceguid As Guid, _
Byref Result As IactiveDesktop) AS INTPTR
END FUNCTION
PRIVATE CLSID_ACTIVEDESKTOP AS New GUID ("75048700-EF1F-11D0-9888-006097DEACF9")
Private IID_IACTIVEDESKTOP AS New GUID ("F490EB00-1240-11D1-9888-006097DEACF9) Private const clsctx_inproc_server as integer = 1
Private ActiveDesktop as IactiveDesktop
The following statement is to create an IACTIVEDESKTOP object.
CoCreateInstance (CLSID_ACTIVEDESKTOP, INTPTR.ZERO, CLSCTX_INPROC_SERVER, IID_IACTIVEDESKTOP, ACTIVEDESKTOP) Release the object:
Marshal.releaseComobject (ActiveDesktop)
The two statements here are used to save images on the desktop. ActiveDesktop.Setwallpaper (PicturePathname, 0)
ActiveDesktop.ApplyChanges (_WIN32.AD_Apply_force or _win32.ad_apply_save or _win32.ad_apply_refresh)