Hi, I'm new to Win32::GUI, but I've been using Perl for a while.  I have
been trying to go through a tutorial I found on the web, and I've customized
it a little bit, but not alot, so I can't figure out what's wrong.  Maybe
I'm misunderstanding the method.  Anyway, below is my code, and what is
happening is that my program is telling me that it can't un-hide the window
and then the cursor is showing an hourglass.  I don't want to add anything
else until I figure out what I've already gotten wrong.

###################################

use Win32::GUI;
use Win32;
use strict;
$| = 1;

#declare Win32::GUI objects
my $main = Win32::GUI::Window->new(-width => 100, -height => 100, -name =>
'Main', -text => "ZipSD v1.0");
my $font = Win32::GUI::Font->new(-size => 10, -name => "Verdana", -bold =>
1);

#Add controls
my $label = $main->AddLabel(-text => "This is my text.", -font => $font);

#Show Result
CenterWindow();
PresentWindow();


#SUBS
sub GetClientSize{
        my $ncw = $main->Width() - $main->ScaleWidth();
        my $nch = $main->Height() - $main->ScaleHeight();
        my $w = $label->Width() + $ncw;
        my $h = $label->Height() + $nch;
        return ($w,$h);
}

sub CenterWindow{
        my $w = $main->Width();
        my $h = $main->Height();
        my $desk = Win32::GUI::GetDesktopWindow();
        my $dw = Win32::GUI::Width($desk);
        my $dh = Win32::GUI::Height($desk);
        my $x = ($dw - $w) / 2;
        my $y = ($dh - $h) / 2;
        $main->Move($x, $y);
}


sub PresentWindow{
        $main->Resize(GetClientSize()) || ErrMsg("Could not resize
Window!\n");
        $main->Show() || ErrMsg( "Could not un-hide window!\n");
        }
        $main->Dialog() || ErrMsg("Could not start dialog!\n");
}

sub ErrMsg{
        Win32::MsgBox($_[0],MB_ICONSTOP,"ZipSD Error");
}



Tim Johnson
SanDisk
Network Administrator
[EMAIL PROTECTED] 
phone: (408) 542-0776 




--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

Reply via email to