Harold,

Thanks!!! I think that will work well enough for me.

Jonathan
  ----- Original Message ----- 
  From: Piske, Harald 
  To: 'perl-win32-gui-users@lists.sourceforge.net' 
  Sent: Wednesday, March 28, 2001 5:46 PM
  Subject: RE: [perl-win32-gui-users] desktop


  Hi Jonathan.
   
  I found a way - not exactly easy, probably far from perfect, but it works. I 
hide all windows - walking backwards through the chain of desktop children, to 
avoid making each active just before hiding it. Then I cover the background 
with a big, fat, ugly, black rectangle and show my own window. Note I restore 
all the hidden stuff in END{}. Otherwise, if your program dies, you'll end up 
with a perfectly invisible OS. On the other hand, that might avoid a few 
annoying windows faults ...
   
  Have fun
  Harald
   
  use Win32::GUI;
  use Win32::API;

  BEGIN
  {
   undef $blank;
   undef @hidden;
   $CreateWindowEx = new Win32::API ('user32', $_ = 'CreateWindowEx',
    [N,P,P,N,I,I,I,I,I,I,I,P], I) or die $_;
   $ShowWindow = new Win32::API ('user32', $_ = 'ShowWindow', [I, I], I)
    or die $_;
   $DestroyWindow = new Win32::API ('user32', $_ = 'DestroyWindow', [I], I)
    or die $_;
  }
  END
  {
   $ShowWindow->Call ($_, 8) for @hidden;
   $DestroyWindow->Call ($blank) if $blank;
   undef $CreateWindowEx;
   undef $DestroyWindow;
   undef $ShowWindow;
  }
  $Main = new Win32::GUI::Window (-name => 'Main',
   -pos => [100, 100], -size => [400, 300]);
  sub Main_Terminate {-1}
  $Main->AddLabel (-name => $_ = 'All alone!',
   -text => $_, -pos => [160, 110]);
  $desktop = $Main->GetDesktopWindow ();
  $_ = Win32::GUI::GetWindow ($desktop, GW_CHILD);
  $_ = Win32::GUI::GetWindow ($_, GW_HWNDLAST);
  do {
   if (Win32::GUI::IsVisible ($_)) {
    push @hidden, $_;
    $ShowWindow->Call ($_, 0);}
  } while $_ = Win32::GUI::GetWindow ($_, GW_HWNDPREV);
  @area = Win32::GUI::GetWindowRect ($desktop);
  $blank = $CreateWindowEx->Call (0, $_ = 'STATIC', '', 
   0x5C000004, @area, $desktop, 0, 0, 0) or die $_;
  $Main->Show ();
  Win32::GUI::Dialog ();

    -----Original Message-----
    From: Jonathan Southwick [mailto:[EMAIL PROTECTED]
    Sent: Wednesday, March 28, 2001 10:31
    To: [EMAIL PROTECTED]
    Subject: [perl-win32-gui-users] desktop


    Is there any way to blackout the desktop (as a screensaver would) using the 
GUI module?  I still want to be able to show my own windows I create in my 
program.

    Jonathan Southwick
    Technical & Network Services
    Allegheny College, Meadville, PA
    [EMAIL PROTECTED]

Reply via email to