> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf
> Of Bellenger, Bruno (Paris)
> Sent: Wednesday, May 24, 2000 10:24
> To: Perl-Win32-Users Mailing List
> Subject: FW: How to modify the Screen Saver setting with PERL?
>
>
> By the way, changes to those keys will only be active after the next login.
> Maybe someone has a clue how to force the system to reread the user settings
> ?
>
Here's the snippet of code I use for changing background/wallpaper images.
I use it for displaying error messages during scripted post-ghost workstation
customizations - therefore it works from a service to set the default desktop
too!.
# Code Follows:
use Win32::API;
Display(bitmap => 'new_wallpaper.bmp', verbose => 1);
exit;
sub Display (%) {
my (%argv) = @_;
my ($arg, $path, $verbose);
# Read parameters from argument list.
foreach $arg (keys %argv) {
if ($arg eq 'path') { $path = $argv{$arg}; }
if ($arg eq 'bitmap') { $bitmap = $argv{$arg}; }
if ($arg eq 'verbose') { $verbose = ($argv{$arg} ? 1 : 0); }
}
# Bitmaps are expected to be in c:\winnt by default.
# SystemParameterInfo() is never really happy if the bitmap is in
# another directory tree. (C:\foo\ BAD, C:\winnt\foo\ OK)
if (defined $bitmap) { $path = "C:\\winnt\\" . $bitmap; }
# Ensure name given exists
if (-e $path) {
# Define function call to user32.dll/SystemParametersInfo().
# Takes 4 args (2 DWORD (numeric) args, string pointer,
# 1 DWORD (numeric) flag) returns 1 numeric argument (BOOL really)
my $fcnSPIa = new Win32::API("user32", "SystemParametersInfo",
['N', 'N', 'P', 'N'], 'N');
printf ("Display(): Bitmap path = \'$path\'.\n") if ($verbose);
# SystemParameterInfo(SPIF_SETDESKWALLPAPER, NULL,
# filename, SPIF_SENDCHANGE)
my $result = $fcnSPIa->Call(20, 0, $path, 2);
printf ("Display(): SystemParametersInfo returned $result.\n")
if ($verbose);
} else {
printf ("Display(): Unable to locate bitmap at \'$path\'.\n");
}
}
Mark Leighton
----------------------------+-----------------------------------------------
Mark's Message Factory | One Hundred Monkeys on One Hundred Typewriters
[EMAIL PROTECTED] | Serving YOU Daily. Please call for BULK rates.
----------------------------+-----------------------------------------------
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]