http://qs321.pair.com?node_id=373632


in reply to set windows background picture

The code is fine, works here on WinXP. Convert yahoo.gif to yahoo.bmp and try again.

Update: Also, take a look at Win32::Wallpaper and this article by Dave Roth - there's some code there to do it.

Update 2: Also, I know I mentioned this in a PM, but Active Desktop doesn't play nice - make sure to get rid of it. Looks like your code is the same as Simple script to change win32 wallpaper, which is two years old and hasn't had a complaint - so it's my guess that, as I originally suspected - it's not the code.

Replies are listed 'Best First'.
Re^2: set windows background picture
by pg (Canon) on Jul 12, 2004 at 19:33 UTC

    Thanks roju for all your helps, including those chats you sent me.

    For your update 2, It still does not work for me even with active desktop disabled.

    For update 1, I looked at the source code for Win32::Wallpaper, and made up this to mimic it:

    use strict; use warnings; use Win32::API; my $SystemParametersInfo = new Win32::API(qw(user32 SystemParametersIn +foA NNPN N)) || die $^E; $SystemParametersInfo->Call( 20, 0, "c:\\perl582\\bin\\yahoo.bmp",1 ) +|| die $^E;

    Unfortunately it still does not work. But yes, I agree with you, my source code was most likely alright. Something is wrong ;-)


      I tested here in a Win 2000 and it didn't work also...
      (so it is not only you :))
      I really really really hate this answer, but did you try rebooting? I remember seeing code up here to change the wallpaper and thinking it was very cool, only to find that the change was not effected immediately.
Re^2: set windows background picture
by pg (Canon) on Jul 12, 2004 at 15:50 UTC

    Converted the picture to .bmp, but it didn't work, and return code became 1.

    Tried to set through windows by right click on desktop, both .gif and .bmp worked...