#########################################
Drucker-Einstellungen holen und setzen
ab Win 9.X und Profan 7.X
Andreas Miethe * Dezember 2000
#########################################
$I Winspool.inc
Declare TTT&,LB&,LB1&,LB2&,LB3&,LB4&,LB5&
Declare Ende%,GetP&,SetP&,Config&,Config1&,GoOut&
Declare Picture$
settruecolor 1
WindowTitle Druckereinstellungen......
Window add(%maxx,1),0-640,480
cls @GetSysColor(15)
UseIcon DRUCKER
Usefont MS Sans Serif,14,0,0,0,0
SetDialogfont 1
Proc Fensteraufbau
TTT& = Createtext(%hwnd,,12,0,600,14)
Createtext(%hwnd,Allgemeine Infos,12,14,300,24)
Let LB& = CreateListbox(%hwnd,,0,0,0,0)
SetDefaultGUIFont(LB&)
Createtext(%hwnd,Druckerschächte,12,114,300,14)
Let LB1& = CreateListbox(%hwnd,,0,0,0,0)
SetDefaultGUIFont(LB1&)
Createtext(%hwnd,unterstützte Papierformate,12,214,300,14)
Let LB2& = CreateListbox(%hwnd,,0,0,0,0)
SetDefaultGUIFont(LB2&)
Createtext(%hwnd,Installierte Drucker,12,315,300,14)
Let LB5& = CreateListbox(%hwnd,,0,0,0,0)
SetDefaultGUIFont(LB5&)
Createtext(%hwnd,Format-NR.,322,214,90,14)
Let LB3& = CreateListbox(%hwnd,,0,0,0,0)
SetDefaultGUIFont(LB3&)
Createtext(%hwnd,aktuelle Einstellungen, Werte und Möglichkeiten,322,14,320,14)
Let LB4& = CreateListbox(%hwnd,,0,0,0,0)
SetDefaultGUIFont(LB3&)
Let SetP& = CreateButton(%hwnd,Standard-Drucker wechseln,320,405,220,20)
SetDefaultGUIFont(SetP&)
Let Config& = CreateButton(%hwnd,Drucker einrichten,320,355,220,20)
SetDefaultGUIFont(Config&)
Let Config1& = CreateButton(%hwnd,Drucker - Eigenschaften,320,380,220,20)
SetDefaultGUIFont(Config&)
Let GoOut& = CreateButton(%hwnd,Ende,440,260,80,20)
SetDefaultGUIFont(GoOut&)
@Control(Static,Drucker,$50000003,580,390,0,0,%hwnd,0,%Hinstance,0)
Settext TTT&,Drucker : +GetNDP_STDPrinter(1)+ an : +GetNDP_STDPrinter(3)
SetWindowlong(LB&,-16,or(GetWindowlong(LB1&,-16),$50200000))
SetWindowlong(LB1&,-16,or(GetWindowlong(LB1&,-16),$50200000))
SetWindowlong(LB2&,-16,or(GetWindowlong(LB1&,-16),$50200000))
SetWindowlong(LB3&,-16,or(GetWindowlong(LB1&,-16),$50200000))
SetWindowlong(LB4&,-16,or(GetWindowlong(LB1&,-16),$50200000))
SetWindowlong(LB5&,-16,or(GetWindowlong(LB1&,-16),$50200000))
Setwindowpos LB& = 10,30-300,80
Setwindowpos LB1& = 10,130-300,80
Setwindowpos LB2& = 10,230-300,80
Setwindowpos LB3& = 320,230-100,80
Setwindowpos LB4& = 320,30-300,180
Setwindowpos LB5& = 10,335-300,90
EndProc
Proc GetInfo
Declare msg&,msgt&
If GetNDP_STDPrinter(1) <>
UseCursor 2
LockWindowUpdate(%hwnd)
msg& = CreateDialog(%hwnd,Moment bitte...,add(%maxx,1),0,0,0)
msgt& = Createtext(msg&,ermittle Werte..........,20,2,180,20)
Setwindowlong(msg&,-16,$50C00000)
Setwindowlong(msg&,-20,$50000280)
Setwindowpos msg& = sub(Width(%Desktop)/2,100) ,sub(Height(%desktop)/2,22) - 200,45
Settext TTT&,Drucker : +GetNDP_STDPrinter(1)+ an : +GetNDP_STDPrinter(3)
GetPrinters LB5&
GetPrinterCaps LB&
PrinterBins LB1&
PaperNames LB2&
PaperFlags LB3&
Akt_Printer_Einstellungen LB4&,LB2&,LB3&
GetPrinterParameter LB4&
Destroywindow(msg&)
LockWindowUpdate(0)
UseCursor 0
else
Printer_Error 1
Endif
EndProc
Fensteraufbau
setwindowpos %hwnd = sub(Width(%Desktop)/2,320) ,sub(Height(%desktop)/2,240) - 640,480
GetPrinters LB5&
GetInfo
SetFocus(%hwnd)
Whilenot ende%
waitinput
If GetFocus(GetP&)
PrintPrinter LB4&
setFocus(%hwnd)
Elseif GetFocus(SetP&)
If @getCursel(LB5&) > -1
ChangeStandardPrinter Getstring$(LB5&,@GetCursel(LB5&))
Settext TTT&,Drucker : +GetNDP_STDPrinter(1)+ an : +GetNDP_STDPrinter(3)
GetInfo
setFocus(%hwnd)
else
Printer_Error 2
Endif
Elseif GetFocus(Config&)
If GetNDP_STDPrinter(1) <>
DocProp 1
Case @&(0) = 1: GetInfo
setFocus(%hwnd)
else
Printer_Error 1
Endif
Elseif GetFocus(Config1&)
If GetNDP_STDPrinter(1) <>
PrnProp
Case @&(0) = 1: GetInfo
setFocus(%hwnd)
else
Printer_Error 1
Endif
Elseif GetFocus(GoOut&)
Let Ende% = 1
Endif
EndWhile
End