RE: How to modify the Screen Saver setting with PERL?

2000-05-25 Thread Mark Leighton

 -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]




RE: How to modify the Screen Saver setting with PERL?

2000-05-25 Thread Mark Leighton

Hi Oliver,

Read the documentation with Win32::API (since it provides access to the
functions in any .dll) and get the documentation for the dlls themselves.  If
the dlls come with the OS, then Microsoft's SDK can be downloaded from
http://msdn.microsoft.com/downloads/sdks/platform/platform.asp

The SDK is a huge download (100M) but has lots of nifty tools and documents
most of the API calls.  It is often thin on example code and you have to do
argument translation (structures can be nasty as discussion on the list has
described) but hey, you can really do some nifty things.

Good luck,

Mark

 -Original Message-
 From: Oliver Manickum [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 25, 2000 09:30
 To: Mark Leighton
 Subject: RE: How to modify the Screen Saver setting with PERL?


 Hey Mark,

 Thank you for the informative code :OD .. where can I get more information
 on using the perl api ?

 - Oliver


+---
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]




RE: How to modify the Screen Saver setting with PERL?

2000-05-24 Thread tim_meadowcroft




 I bet the screen saver and background images are simply registry values. If
 I were trying to do a similar task, I would search Microsoft's web page to
 find out what registry setting is used to set these things, and then get a
 registry module from www.cpan.org to set the registry key.

Or go to http://www.sysinternals.com/ and download a copy of RegMon (Registry
Monitor).

Run that, change the settings manually, and watch to see what is done to the
registry.

MS docs for these sort of things tend to be a little thin on the ground.

Tim





_
  
The information contained in this message is intended for the addressee
only and may contain confidential and/or privileged information.
If you are not the addressee, please delete this message and notify the
sender; you should not copy or distribute this message or disclose its
contents to anyone.
Any views or opinions expressed in this message are those of the author
and do not necessarily represent those of WestLB or any of its affiliates.
No reliance may be placed on this message without written confirmation
from an authorised representative of its contents.

---
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]




RE: How to modify the Screen Saver setting with PERL?

2000-05-24 Thread Bellenger, Bruno (Paris)


Everything you need to change the screen saver's settings can be found in 

HKEY_CURRENT_USER\Control Panel\Desktop

But that's only for your interactive session, of course.

Changing other users (including remote) settings is a bit more tricky as the

registry path will include the user's SID, which you must query first.


HKEY_USERS\USER'S SID\Control Panel\Desktop


As for the System (Default) settings, the values can be found in 

HKEY_USERS\.DEFAULT\Control Panel\Desktop


Values in there relevant to background and screensaver will include :

ScreenSaveTimeOut   2700
ScreenSaveActive1
SCRNSAVE.EXEC:\WINNT\System32\LOGON.SCR
ScreenSaverIsSecure 1
Pattern (None)
Wallpaper   (Default)
TileWallpaper   0

_
Bruno Bellenger
Sr. Network/Systems Administrator 

-Original Message-
From:   Douglas Galbraith [SMTP:[EMAIL PROTECTED]]
Sent:   Tuesday, May 23, 2000 14:42
To: Perl-Win32-Users Mailing List
Subject:How to modify the Screen Saver setting with PERL?

I would like to use PERL to change the Screen Saver settings on my
machine
(to work around a BIOS bug).  Below is an example of how to do it 
manually:

  Start - Settings - Control Panel
  Display - Screen Saver - Settings
  Turn off monitor - 1 minute (or some other value)
  Apply
  OK

I've use PERL to launch and run IE, so I'm assuming that there are
ways to
also use it to execute other WINDOWS98 commands.  If so, could you
give
me some pointers on how to do it?  If not, then let know so that I
don't
waste time looking.

Thanks for the help,
[EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]



---
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]




RE: How to modify the Screen Saver setting with PERL?

2000-05-23 Thread Hogue, Jon

I bet the screen saver and background images are simply registry values. If
I were trying to do a similar task, I would search Microsoft's web page to
find out what registry setting is used to set these things, and then get a
registry module from www.cpan.org to set the registry key.

 -Original Message-
 From: Douglas Galbraith [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 23, 2000 8:42 AM
 To: Perl-Win32-Users Mailing List
 Subject: How to modify the Screen Saver setting with PERL?
 
 
 I would like to use PERL to change the Screen Saver settings 
 on my machine
 (to work around a BIOS bug).  Below is an example of how to do it 
 manually:
 
   Start - Settings - Control Panel
   Display - Screen Saver - Settings
   Turn off monitor - 1 minute (or some other value)
   Apply
   OK
 
 I've use PERL to launch and run IE, so I'm assuming that 
 there are ways to
 also use it to execute other WINDOWS98 commands.  If so, 
 could you give
 me some pointers on how to do it?  If not, then let know so 
 that I don't
 waste time looking.
 
 Thanks for the help,
 [EMAIL PROTECTED]
 
 ---
 You are currently subscribed to perl-win32-users as: 
 [EMAIL PROTECTED]
 To unsubscribe, forward this message to
  [EMAIL PROTECTED]
 For non-automated Mailing List support, send email to  
  [EMAIL PROTECTED]
 

---
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]




Re: How to modify the Screen Saver setting with PERL?

2000-05-23 Thread Ian D. Stewart

"Hogue, Jon" wrote:
 
 I bet the screen saver and background images are simply registry values. If
 I were trying to do a similar task, I would search Microsoft's web page to
 find out what registry setting is used to set these things, and then get a
 registry module from www.cpan.org to set the registry key.

Win32::Registry (included with the ActiveState distribution) should be
able to handle this once you know what needs to be set.


Ian


-- 
99 little bugs in the code, 99 bugs in the code.
Fix one bug, compile again, 100 little bugs in the code.
100 little bugs in the code, 100 bugs in the code.
Fix one bug, compile again, 101 little bugs in the code...

---
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]