English
Source / code snippets

printer settle Standarddrucker

 
E.T. (11.01.11)

Have time a little bit "gebastelt":
CompileMarkSeparation
'############### ##########
'Drucker auflisten
'Andreas Miethe * Juni 2003
'##########################
DEF EnumPrinters(7) ! "WINSPOOL.DRV","EnumPrintersA"
DEF GetStandardPrinter(0) Substr$(ReadIni$("WIN.INI","Windows","Device"),1,",")
DEF &PRINTER_ENUM_LOCAL 2
DEF &PRINTER_ENUM_DEFAULT 1
Declare PrinterValues#, Drucker$[], Y&, Old_Standard$, Old_Standard_rest$
DEF GetStandardPrinter2(0) ReadIni$("WIN.INI","Windows","Device")

Proc EnumPrinters

    Declare Printername&,Portname&,PrinterName$,PortName$,Attribs&
    Declare X&,dwNeeded&,dwReturned&
    EnumPrinters(&PRINTER_ENUM_LOCAL,0,5,0,0,ADDR(dwNeeded&),ADDR(dwReturned&))
    Dim PrinterValues#,dwNeeded&
    Clear PrinterValues#
    EnumPrinters(&PRINTER_ENUM_LOCAL ,0, 5, PrinterValues#, dwNeeded&, ADDR(dwNeeded&), ADDR(dwReturned&))

    While X& < dwReturned&*20

        Printername& = Long(PrinterValues#,x&)
        PrinterName$ = String$(Printername&,0)
        Attribs& = Long(PrinterValues#,x&+8)
        'folgendes funzt bei mir unter XP nicht:
        '	     If Attribs& & $4
        '            Printername$ = Printername$ + " => Standarddrucker"
        '       endif
        Drucker$[Y&] = Printername$
        X& = X& + 20
        inc Y&

    EndWhile

    Dispose PrinterValues#

Endproc

Proc Set_Std_Printer

    Parameters PrinterString$
    WriteIni "WIN.INI","Windows","Device"=PrinterString$

EndProc

cls
EnumPrinters
Print "Gefundene Drucker"

WhileLoop 0,Y&-1

    Print "Drucker " + @str$(&loop) + " : " + Drucker$[&loop]

EndWhile

Old_Standard$ = Substr$(GetStandardPrinter2(),1,",")
Old_Standard_rest$ = Substr$(GetStandardPrinter2(),-2,",") + "," + Substr$(GetStandardPrinter2(),-1,",")
Print "***"
Print "Standard-Drucker :"
Print Old_Standard$
Print "***"
Print "Drucke auf Drucker " + Drucker$[4]
Set_Std_Printer Drucker$[4] + "," +Old_Standard_rest$
StartPrint
DrawText 10,10,"Test " + Drucker$[4]
EndPrint
Print "Drucke auf Drucker " + Drucker$[2]
Set_Std_Printer Drucker$[2]+","+Old_Standard_rest$
StartPrint
DrawText 10,10,"Test " + Drucker$[2]
EndPrint
Print "***"
Print "   >>>alten Standart-Drucker wieder einstellen.."
Set_Std_Printer Old_Standard$+","+Old_Standard_rest$
Print "Standard : " + Old_Standard$
Print "***"
Print ""
Print "...warte"
put end

created by me the following Window (sees nat. each differently from, according to install. Printers...)



and functions wonderful. with pdf comes The request "wo speichern", and with Fax becomes to 'ner Fax-number demand. means go The printer correctly. staid.

May eachone from it make, what it wants ...
 
01/11/11  
 




Dieter
Zornow
with only 3 Printers is printer$[4] naturally not there, therefore is a Errors in the code
 
Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2
01/11/11  
 




Jörg
Sellmeyer
you mußt absolutely a Link to that Original-Posting reinsetzen You old Sterneabstauber
and of course directly to that Posting and not only to that Thread!
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
01/11/11  
 




E.T.
Dieter Zornow (11.01.11)

with only 3 Printers is printer$[4] naturally not there, therefore is a Errors in the code


Klaro, and if I quite none printer Have, Better get going yet rather
but the having Examples blut on itself...
 
Grüße aus Sachsen... Mario
WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte...
01/11/11  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.909 Views

Untitledvor 0 min.
Erasmus.Herold01/21/23
Axel Berse07/27/22
Torben Nissen01/27/21
rquindt05/30/20
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie