Page 1 of 1 1
Topic Options
#190186 - 2008-10-20 11:27 PM Wallpaper with BGInfo
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
I've been experimenting with the following code (which doesn't work) and now I have got so close to it, "I can't see the wood for all the trees in the way!"

The client has designed two JPG files for each style of screen resolution within the organisation and wants me to push the wallpaper out to all workstations. He will periodically change the content of the wallpaper so it acts like a business phone directory on each user's desktop.

I have the UDF GetScreenRes() pasted at the end of the code and the variable $ScreenRes is populating correctly.


 Code:
;*********************** COPY WALLPAPER *****************************

IF @TSSESSION <> 1
  $ScreenRes = GetScreenRes()
  SELECT
    CASE $ScreenRes = "1280,1024"
      $Wallpaper = "Desktop1280x1024.jpg"
    CASE $ScreenRes = "1440,900"
      $Wallpaper = "Desktop1440x900.jpg"
    CASE 1
      $Wallpaper = "Desktop1280x1024.jpg"
  ENDSELECT    

  IF EXIST($WinDir + "\" + $WallPaper) = 0
    COPY @LSERVER + "\Netlogon\Wall\" + $WallPaper $WinDir + "\WallPaper.jpg"
  ENDIF

  $WallpaperStyle = "2"
  $TileWallpaper = "0"
  $WallpaperMode = "1"

  $=WriteValue('HKCU\Control Panel\Desktop','Wallpaper',$Wallpaper,'REG_SZ')
  $=WriteValue('HKCU\Control Panel\Desktop','WallpaperStyle',$WallpaperStyle,'REG_SZ')
  $=WriteValue('HKCU\Control Panel\Desktop','TileWallpaper',$TileWallpaper,'REG_SZ')
  $=SetWallpaper("Wallpaper.jpg", $WallpaperMode)
ENDIF

;*********************** COPY BGINFO *********************************

IF EXIST($WinDir + "\Bginfo.exe") = 0
  COPY @LSERVER + "\Netlogon\Bginfo.exe" $WinDir + "\Bginfo.exe"
ENDIF

SHELL $WinDir + "\BGInfo \\$HomeServer\NETLOGON\Wall\SUMMIT.bgi /TIMER:0"

;********************************************************************


Can someone point me in the right direction...

Top
#190187 - 2008-10-21 12:33 AM Re: Wallpaper with BGInfo [Re: Ashpoint]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
So I guess the forest is completely out of the question, eh?

We use BGInfo pretty heavily, and the one thing I've found is that if you put the image in the Windows folder, it will get created by the first user to log on, and subsequent users will not have permission to change/update it. We use a BG config file on the netlogon share to update the image, which is stored in C:\Temp. We create C:\Temp with Auth-Users:Modify rights, so anyone can overwrite the file easily. We don't ever copy BGInfo.exe or the config file to the local PC - it runs directly from the Netlogon share. Finally, we define the wallpaper through GPO so the user can't modify it.

There's a bug in your code, too.. I'll see if I can't clean it up and post back.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#190188 - 2008-10-21 12:40 AM Re: Wallpaper with BGInfo [Re: Ashpoint]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Here's the updated but untested code:


;*********************** COPY WALLPAPER ***************************** 
 
IF @TSSESSION <> 1
  $ScreenRes = GetScreenRes()
  ; set the wallpaper source var based on screen res 
  SELECT
    CASE $ScreenRes = '1280,1024'
      $Wallpaper = 'Desktop1280x1024.jpg'
    CASE $ScreenRes = '1440,900'
      $Wallpaper = 'Desktop1440x900.jpg'
    CASE 1
      $Wallpaper = 'Desktop1280x1024.jpg'
  ENDSELECT    
 
  IF Not Exist('%TEMP%\Wallpaper.jpg')	; you can't check for one file when it's really another file! 
    COPY '\\%USERDOMAIN%\Netlogon\Wall\' + $WallPaper '%TEMP%\WallPaper.jpg'
  ENDIF
 
  $WallpaperStyle = '2'
  $TileWallpaper = '0'
  $WallpaperMode = '1'
 
  ; This should also reference the destination file, not the source file name! 
  $=WriteValue('HKCU\Control Panel\Desktop', 'Wallpaper', '%TEMP%\WallPaper.jpg', 'REG_SZ')
  $=WriteValue('HKCU\Control Panel\Desktop', 'WallpaperStyle', $WallpaperStyle, 'REG_SZ')
  $=WriteValue('HKCU\Control Panel\Desktop', 'TileWallpaper', $TileWallpaper, 'REG_SZ')
  $=SetWallpaper('Wallpaper.jpg', $WallpaperMode)
ENDIF
 
;*********************** RUN BGINFO ********************************* 
 
SHELL '\\%USERDOMAIN%\Netlogon\BGInfo.exe \\%USERDOMAIN%\NETLOGON\Wall\SUMMIT.bgi /TIMER:0'
 
Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#190204 - 2008-10-21 12:58 PM Re: Wallpaper with BGInfo [Re: Glenn Barnas]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
Hi Glenn,

That didn't work for me but I think it's now my issue and believe that remnants of the old BGINFO stuff is still on the workstation causing issues. I'll disable the BgInfo stuff and experiment further.

It's late night here so I will give it another run tomorrow.

I'm confident your work has set me on the correct path.

As in the past when I have had (free) help such as yours, I have now sent an email and made a donation to the National Breast Cancer Foundation here in Sydney (Australia).

Best regards,
Michael

Top
#190206 - 2008-10-21 01:13 PM Re: Wallpaper with BGInfo [Re: Ashpoint]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
I think I have found the issue - can you confirm?

The documents say that the SETWALLPAPER() function only works with a .BMP and not a .JPG


So maybe I need to get the client to change his image to a .BMP


Michael

Top
#190209 - 2008-10-21 01:33 PM Re: Wallpaper with BGInfo [Re: Ashpoint]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
True.
I never got SetWallpaper() to work with anything else then a bmp image.

I do have a jpg set as wallpaper but when I look in this registry key HKCU\Control Panel\Desktop it gets converted to a .bmp.


Edited by Mart (2008-10-21 01:37 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#190210 - 2008-10-21 01:38 PM Re: Wallpaper with BGInfo [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
.JPG only works with the web-enabled desktop, which I've always avoided, and (thankfully) is not enabled by default. Not sure it's even there anymore in XP, since I've always ignored it. ;\)

My example code wasn't tested - I just found several inconsistencies in your original code - compare the two and see what's changed. Seemed like the vines and underbrush were attacking the trees.

I can post our BGI.kix when I get to the office today.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#190230 - 2008-10-21 10:30 PM Re: Wallpaper with BGInfo [Re: Mart]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: CA
That is the process that Windows actually uses for using a JPG image on the Desktop. It has a bitmap copy of the JPG file.

I did not document it myself but did track down how it actually operates a long time ago. I'm sure if you search enough you'll find the Microsoft documentation that explains the "path" of how it's done.

Top
#190247 - 2008-10-22 07:44 PM Re: Wallpaper with BGInfo [Re: NTDOC]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
Hello Glen...

....I can post our BGI.kix when I get to the office today....

Nudge!

I would be really interested in your code.


Top
#190257 - 2008-10-22 09:47 PM Re: Wallpaper with BGInfo [Re: Ashpoint]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
ZZZzzzz... eh - what?? huh? Oh.. sorry!

Actually, I don't have a kix script, as it turns out. My login script calls a bat file to run the BGInfo.
 Code:
@Echo off
If Exist %WINDIR%\BGInfo.bmp Del %WINDIR%\BGInfo.bmp
\\ad.domain\netlogon\BGI\BGInfo.exe /timer:0 /i\\ad.domain\NetLogon\BGI\NetClient.bgi

The If Exist is there just to remove the old backgrounds, and is not really required.
The settings in NetClient.bgi are just the basics - username, hostname, IP, OS/SP, Boot time, and disk labels/sizes. We do specify a fixed color, which matches the bgcolor defined in our GPO.

Of course, you could Shell this from Kix pretty easily. My login script is generic, and calls external commands - there was no point for me to use a Kix script simply to shell this executable, so I opted for the bat file, which allowed me to remove the old BG image at the same time.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 661 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.111 seconds in which 0.07 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org