ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
RE: Disabling the x in a window.
by Al Caraciolo other posts by this author
Nov 5 2002 4:56PM messages near this date
view in the new Beta List Site
Disabling the x in a window. | RE: XL column width
You might try cheating:

use Win32::GUI; BEGIN
{Win32::GUI::Hide(scalar(Win32::GUI::GetPerlWindow()))};

That will hide the DOS window so the user won't see it, but my guess is
there must be a better way.  Look up the local grab and the global grab
functions in Tk... they might also work.

$widget-> grab;   #Local grab
$widget-> grabGlobal;

-----Original Message-----
From: perl-win32-users-admin@[...].com
[mailto:perl-win32-users-admin@[...].com]On Behalf Of
Beckett Richard-qswi266
Sent: Tuesday, November 05, 2002 10:25 AM
To: perl-win32-users@[...].com
Subject: Disabling the x in a window.


Hi folks,

I have been trawling Google looking for a solution, and I thought I'd found
it, but for the life of me I can't get it to work, yet it seems a common
answer to the question...

When I start my script, I use the original dos window as a console window,
and create a GUI using Tk.

I want to disable the X in the corner of the console window, so that the
user has to exit the program correctly from the GUI.

Here's what I have...
=-=-=-
# DEFINE THE REQUIRED MODULES
use strict;
use warnings;
use Win32::GUI;

# Open the console window after it minimises (can't stop minimise)
# Do it now, because there's a long pause on slower machines otherwise.
my $perlwin = Win32::GUI::GetPerlWindow();
Win32::GUI::OpenIcon($perlwin);
Win32::GUI::Move($perlwin, 0, 0);
print "Loading, please wait for the GUI window...\n";

# Define rest of modules.
use Net::FTP;
use Net::Cmd;
use Time::HiRes qw( usleep gettimeofday tv_interval );
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Variant;
use Win32::OLE::NLS qw(:LOCALE :DATE);
$Win32::OLE::Warn = 0; # I'll handle errors myself!
use Cwd;
use Win32::Console;
use Tk;
use Tk::Menu;
use Tk::Widget;
use TK::DialogBox;
use Tk::ErrorDialog;

$perlwin = Win32::GUI::GetPerlWindow();
$perlwin-> protocol('WM_DELETE_WINDOW' => sub{});

When this runs, I get the follwing error:

Loading, please wait for the GUI window...
Can't call method "protocol" without a package or object reference at
multi-ftp-v31.pl line 39.

I really don't know what I'm doing wrong, and it's driving me knuts!

Thanks.

R.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Beckett Richard-qswi266
Al Caraciolo

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved