1 2 3 4 5 6 7 8
use strict; use Win32::Printer; my $dc = new Win32::Printer( dialog => PRINTSETUP ); $dc->Abort(); # Dass er nicht druckt... #$dc->Close(); # Hiermit würde er nach dem OK drucken
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
use Win32::GUI(); my $selected_item; my @drucker = ('HP Inkjet', 'Laser 2'); my $main = Win32::GUI::Window->new(-name => 'Main', -text => 'Druckerauswahl', -width => 200, -height => 200); my $lv = $main->AddListView( -singlesel => 1, -pos => [ 0, 0 ], -size => [ 190, 125 ], ); $lv->InsertColumn( -index => 0, -text => "Drucker", ); $lv->ColumnWidth(0,180); for my $dr (@drucker) { $lv->InsertItem(-text => $dr); } $main->AddButton( -name => "IB", -text => "Drucker setzen", -onClick => \&savePrinter, ); $main->Show(); Win32::GUI::Dialog(); sub lv_Click { ($selected_item) = $lv->SelectedItems(); } sub savePrinter { # hier Drucker abspeichern!!!! $selected_item; } sub Main_Terminate { -1; }