Re: modfy the desktopbackground
- From: "Michael M." <nospam@xxxxxxxx>
- Date: Thu, 28 Jun 2007 14:13:31 +0100
Yes,
Windows can not display a jpeg directly on screen, just as media player can
not display an Mpeg movie directly on the on the screen without decoding it,
a filter is always used to decompress it to a bitmap, so even when you load
a jpeg directly it is filtered by a codec into a bitmap in memory and then
displayed.
Mike.
"JR" <x.x@xxx> wrote in message
news:7DGgi.7314$fX5.282847@xxxxxxxxxxxxxxxxxxxxxxxx
thanks all
"Joergen Bech @ post1.tele.dk>" <jbech<NOSPAMNOSPAM> schreef in bericht
news:ltbl73hab2s75alamd0dlhovd6oanjmr3j@xxxxxxxxxx
Why don't you just convert the jpg file to bmp and set
the bmp?
I believe it will take up the same amount of memory once
Windows has to load and present it anyway.
Here is a code sample that takes jpgs:
http://www.codeproject.com/dotnet/SettingWallpaperDotNet.asp
and here:
http://www.devasp.net/net/articles/display/421.html
Both cheat by converting the image to bmp before sending
it to the desktop.
The desktop properties dialog allows you to pick jpg files
and if you rename the file you picked, switch to another background,
then try to select the (now invalid) entry again, it won't work, so
at first sight it does not look like Windows is creating a local bmp
copy from the jpg file selected. But it is. Take a look at
c:\Documents and Settings\<active user name>\Local Settings\
Application Data\Microsoft\ and you will find a file named
"Wallpaper1.bmp", which is the currently selected wallpaper
file converted to bmp. Such a file will not appear if you had
selected a bmp file, as no conversion needs to take place.
I tried the supported formats and only bmp files do not cause
the Wallpaper1.bmp file to be created.
So either you convert the jpg to bmp or Windows will do it for
you. It would appear that the Desktop is not going to take a
jpg directly but needs to go through a cached bmp file.
Yes, you could go the Active Desktop route, but I am sure
your users would not like it.
/Joergen Bech
On Thu, 21 Jun 2007 16:48:49 GMT, "JR" <x.x@xxx> wrote:
Hi,
how can I change the desktopbackground in vb.net to a JPG file
I can do it with a bmp file with the api
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As
Integer,
ByVal lpvParam As String, ByVal fuWinIni As Integer) As Long
'constants to be used with the above api
Private Const SPI_SETDESKWALLPAPER As Integer = 20
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SendWinIniChange As Integer = &H2
Jan
.
- References:
- modfy the desktopbackground
- From: JR
- Re: modfy the desktopbackground
- From: Joergen Bech
- Re: modfy the desktopbackground
- From: JR
- modfy the desktopbackground
- Prev by Date: Re: Using vs. Try Catch
- Next by Date: propper casing of a constant
- Previous by thread: Re: modfy the desktopbackground
- Next by thread: MDI question - how to call other MDI child forms from a MDI chilid form?
- Index(es):
Relevant Pages
|