Fimbulvetr
12-22-2001, 07:50 PM
Hello all, I am trying to make a perl app that pulls IP address( and thier users) from my mysql server and push them into a drop down box. When you select the appropriate user, I want it to pass the arguments to vncviewer.exe so it pulls up the session.
I can pull the stuff from the database with np, I'm just having problems making the button :)
This is the first time I've done Win32, and the 3rd perl program/script I have wrote, so if you want to trash my code, go ahead, I just though I would wanr ahead of time.
The following code properly selects the IP address, and makes the main window, but the button doesnt show up :)
What am I doing wrong?
#!perl.exe
#Tell perl which modules we will need
use DBI();
use Mysql;
use Win32::GUI;
use Win32::GUI::Loft;
use Win32::GUI::Loft: :Design;
#Define the varibles for the connection to Mysql
my $user = "my_user";
my $password = "my_users_password";
$driver = "mysql";
$dsn = "DBI:$driver:database=my_database;host=my_host;port =3306";
$dbh = DBI->connect($dsn, $user, $password) || die "Database connection not made: $DBI::errstr";
#Make the SQL Query
my $sql = qq{ select ip from users_ip where vnc = 1 };
#Check the Query
my $sth = $dbh->prepare( $sql );
#Execute if it passed the check
@names=$sth->execute();
$Window = new Win32::GUI::Window(
-name => "Window",
-title => "Perl Window Example",
-left => 100,
-top => 100,
-width => 300,
-height => 200,
);
$Window->Show();
$Window->AddButton( -name => "Button1" );
$Window->Button1->Show();
Win32::GUI: :Dialog();
sub Button1_Click { print "ouch!\n"; }
sub Window_Terminate
{
return -1;
}
[ 22 December 2001: Message edited by: Fimbulvetr ]
I can pull the stuff from the database with np, I'm just having problems making the button :)
This is the first time I've done Win32, and the 3rd perl program/script I have wrote, so if you want to trash my code, go ahead, I just though I would wanr ahead of time.
The following code properly selects the IP address, and makes the main window, but the button doesnt show up :)
What am I doing wrong?
#!perl.exe
#Tell perl which modules we will need
use DBI();
use Mysql;
use Win32::GUI;
use Win32::GUI::Loft;
use Win32::GUI::Loft: :Design;
#Define the varibles for the connection to Mysql
my $user = "my_user";
my $password = "my_users_password";
$driver = "mysql";
$dsn = "DBI:$driver:database=my_database;host=my_host;port =3306";
$dbh = DBI->connect($dsn, $user, $password) || die "Database connection not made: $DBI::errstr";
#Make the SQL Query
my $sql = qq{ select ip from users_ip where vnc = 1 };
#Check the Query
my $sth = $dbh->prepare( $sql );
#Execute if it passed the check
@names=$sth->execute();
$Window = new Win32::GUI::Window(
-name => "Window",
-title => "Perl Window Example",
-left => 100,
-top => 100,
-width => 300,
-height => 200,
);
$Window->Show();
$Window->AddButton( -name => "Button1" );
$Window->Button1->Show();
Win32::GUI: :Dialog();
sub Button1_Click { print "ouch!\n"; }
sub Window_Terminate
{
return -1;
}
[ 22 December 2001: Message edited by: Fimbulvetr ]