Article View: borland.public.cppbuilder.nativeapi
Article #10962Re: Changing the Desktop Wallpaper
From: Remy Lebeau (TeamB)
Date: Mon, 08 Mar 2004 18:58
Date: Mon, 08 Mar 2004 18:58
38 lines
2187 bytes
2187 bytes
"Robert Hoover" <not.a.real.address@anywhere...sorry> wrote in message
news:404cb832@newsgroups.borland.com...
> But, it only accepts BITMAPs. Is there a VCL object
> or function to accomplish the same thing, adding JPG
> or other formats?
In order to support formats other than BMP, you must first enable
ActiveDesktop in the system's Control Panel. Then you can access the
desktop programmably via the IActiveDesktop interface and call its
SetWallpaper method() (and optionally its SetWallpaperOptions() method as
well). For example.
#include <shlobj.h>
#include <utilcls.h>
TComInterface<IActiveDesktop> ActiveDesktop;
if( SUCCEEDED(CoCreateInstance(CLSID_ActiveDesktop, NULL,
CLSCTX_INPROC_SERVER, IID_IActiveDesktop, (LPVOID*)&ActiveDesktop)) )
{
ActiveDesktop->SetWallpaper(L"c:\\path to\\MyImage.jpg", 0);
ActiveDesktop->ApplyChanges(AD_APPLY_ALL);
}
Have a look at the following articles for more details:
Using the Active Desktop Object
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/activedesktop.asp
IActiveDesktop Interface
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/iactivedesktop/iactivedesktop.asp
Gambit
Technical Details
Message-ID:
<404cc051$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<404cb832@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,5d6d0144e51c775c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-08 11:10:58 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <404cb832@newsgroups.borland.com> Subject: Re: Changing the Desktop Wallpaper Date: Mon, 8 Mar 2004 10:58:41 -0800 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.138.253 Message-ID: <404cc051$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1078771793 67.22.138.253 (8 Mar 2004 10:49:53 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail