PDA

Click to See Complete Forum and Search --> : How to get filename of current set wallpaper


Adrift
Oct 14th, 2000, 01:36 PM
Anyone know how to get the filename of the current windo0ws wallapper? And anyone know how to change the state of the current wallpaper to strech/center/tile and update the wallpaper instantly?
THanks
Adrift

Oct 14th, 2000, 02:12 PM
To determine the current wallpaper's filename:

Public Declare Function GetPrivateProfileString _
Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal _
lpApplicationName As String, ByVal lpKeyName As String, _
ByVal lpDefault As String, ByVal lpReturnedString As _
String, ByVal nSize As Long, ByVal lpFileName As String) As _
Long

Public Function ReadINI(strsection As String, strkey As String, strfullpath As String) As String
Dim strbuffer As String
Let strbuffer$ = String$(750, Chr$(0&))
Let ReadINI$ = Left$(strbuffer$, GetPrivateProfileString(strsection$, ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function


Usage

Private Sub Command1_Click()
MsgBox ReadINI("Desktop", "Wallpaper", "C:\Windows\Win.ini")
End Sub