Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Messager

by TStanley (Canon)
on Sep 14, 2004 at 16:21 UTC ( #390894=sourcecode: print w/replies, xml ) Need Help??
Category: Win32 Stuff
Author/Contact Info Thomas Stanley
Description: The Net::Send module wrapped with a simple Tk interface
#!perl -w
use strict;
use Tk;
use Win32::NetSend;

my $NS=Win32::NetSend->new();

my $Main=new MainWindow;
my $menu=$Main->Menubutton(-text=>'File',-menuitems=>[['command'=>'Exi
+t',-command=>\&Exit]])->grid;
my $un=$Main->Label(-text=>'User Name:');
my $user=$Main->Entry(-width=>40);
$un->grid($user);
my $MsgLbl=$Main->Label(-text=>'Message:');
my $mesg=$Main->Entry(-width=>40);
$MsgLbl->grid($mesg);
my $SndBtn=$Main->Button(-text=>'Send',-command=>sub{Send_Msg($user,$m
+esg)});
my $ClrBtn=$Main->Button(-text=>'Clear',-command=>sub{Clear()});
my $ExtBtn=$Main->Button(-text=>'Exit',-command=>sub{ Exit()});
$SndBtn->grid($ExtBtn,$ClrBtn);
MainLoop;

sub Send_Msg{
  my($user,$message)=@_;
  my $u=$user->get;
  my $m=$message->get;
  $NS->Send(to=>$u,message=>$m);
}

sub Clear{
  $user->delete(0,'end');
  $mesg->delete(0,'end');
  $user->focus;
}

sub Exit{
    exit 0;
}
Replies are listed 'Best First'.
Re: Messager
by Discipulus (Abbot) on Sep 15, 2004 at 08:01 UTC
    funny but how emulate carriage return in NetSend ??

    cheers Discipulus
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://390894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2020-09-22 22:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (130 votes). Check out past polls.

    Notices?