Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set Desktop Wallpaper ??? 1

Status
Not open for further replies.

miq

Programmer
Apr 24, 2002
315
PK
hi,
want to know about API's for setting Desktop Wallpaper.



Bye
miq
 
it's from shell32.dll

You must have active desktop

IActiveDesktop::SetWallpaper
Sets the wallpaper for the Active Desktop.

HRESULT SetWallpaper(
LPCWSTR pwszWallpaper,
DWORD dwReserved
);

Parameters
pwszWallpaper
String value containing the file name of the wallpaper to be set.
dwReserved
Reserved. Must be set to zero.
Return Values
Returns S_OK if successful, or an OLE error code otherwise.
 
In VB, I would suggest that yo use the SystemParametersInfo API Call

Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long

Public Sub SetWallPaper()

Dim FileName As String
Dim Ret As Long

FileName = &quot;<your graphic pathname>&quot;

Ret = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, FileName, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)

End Sub Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
hi,
ALLAPI is offering APIGUIDE. I have used it earlier but the new version is not working. Is their anyother software which provides details about api's.

Thanx. your code worked !!!


bye
miq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top