Re: modfy the desktopbackground



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




.



Relevant Pages

  • Re: Storing and Retreiving JPG images using ADO and StoredProcedures
    ... >as a BMP and thus causes problems when I try to retrieve and display ... I save the scanned image to an actual JPG file on disk. ... >When I examine the file created by the SaveImageData method, ...
    (borland.public.delphi.database.ado)
  • Re: modfy the desktopbackground
    ... Windows can not display a jpeg directly on screen, ... Why don't you just convert the jpg file to bmp and set ... Windows has to load and present it anyway. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: modfy the desktopbackground
    ... Why don't you just convert the jpg file to bmp and set ... Windows has to load and present it anyway. ... Private Const SPI_SETDESKWALLPAPER As Integer = 20 ...
    (microsoft.public.dotnet.languages.vb)
  • THE ANSWER
    ... instructions about deleting the temp files in explorer ... the only format I can save it in is BMP. ... I cannot save any picture file in anything ... >I can save a JPG as a JPG file. ...
    (microsoft.public.windowsxp.photos)
  • Re: Photoshop CS3 usurped Preview function
    ... all image file types with Microsoft Photo Editor, ... double-click any image file, including a .bmp file, then the image ... The default Preview application, on the other hand, is Windows ... after installing the operating system ...
    (microsoft.public.windowsxp.photos)