tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
6
ZUGRIFFE
10282
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Registriert seit
    Dec 2001
    Beiträge
    171
    hey..

    gibt es irgendeine möglichkeit, den standard-schacht eines druckers zu setzen?

    bin für jede antwort dankbar!

    greetings para
     
    Der Verstand und die Fähigkeit, ihn zu gebrauchen, sind zwei verschiedene Gaben!

  2. #2
    NRFi NRFi ist offline Mitglied Brokat
    Registriert seit
    Jul 2003
    Ort
    Behind the mouse
    Beiträge
    321
    hier ein paar apis..

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    Public Declare Function SetPrinter Lib "winspool.drv" Alias "SetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Byte, ByVal Command As Long) As Long
     
    Public Declare Function PrinterProperties Lib "winspool.drv" Alias "PrinterProperties" (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
     
    Public Declare Function PrinterMessageBox Lib "winspool.drv" Alias "PrinterMessageBoxA" (ByVal hPrinter As Long, ByVal error As Long, ByVal hwnd As Long, ByVal pText As String, ByVal pCaption As String, ByVal dwType As Long) As Long
     
    Public Declare Function PrintDlg Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG) As Long
     
    Public Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Any, ByVal cbBuf As Long, pcbNeeded As Long) As Long
     
    Public Declare Function GetPrinterData Lib "winspool.drv" Alias "GetPrinterDataA" (ByVal hPrinter As Long, ByVal pValueName As String, pType As Long, pData As Byte, ByVal nSize As Long, pcbNeeded As Long) As Long
     
    Public Declare Function GetPrinterDriver Lib "winspool.drv" Alias "GetPrinterDriverA" (ByVal hPrinter As Long, ByVal pEnvironment As String, ByVal Level As Long, pDriverInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
     
    Public Declare Function GetPrinterDriverDirectory Lib "winspool.drv" Alias "GetPrinterDriverDirectoryA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pDriverDirectory As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
     
    Für einen ist es Windows, für den anderen die größte Batch-Datei der Welt...

  3. #3
    NRFi NRFi ist offline Mitglied Brokat
    Registriert seit
    Jul 2003
    Ort
    Behind the mouse
    Beiträge
    321
    und dann gibts noch standartmäßig
    print. ...

    auch keine ahnung, ob da was passendes dabei ist, auch keine lust nachzugucken
     
    Für einen ist es Windows, für den anderen die größte Batch-Datei der Welt...

  4. #4
    NRFi NRFi ist offline Mitglied Brokat
    Registriert seit
    Jul 2003
    Ort
    Behind the mouse
    Beiträge
    321
    Declare Function EnumPrinters Lib "winspool.drv" Alias "EnumPrintersA" (ByVal flags As Long, ByVal name As String, ByVal Level As Long, pPrinterEnum As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long

    Declare Function EnumPrinterPropertySheets Lib "winspool.drv" Alias "EnumPrinterPropertySheets" (hPrinter As Long, hwnd As Long, lpfnAdd As Long, ByVal lParam As Long) As Long

    Const PRINTER_ENUM_DEFAULT = &H1
    Const PRINTER_ENUM_LOCAL = &H2
    Const PRINTER_ENUM_CONNECTIONS = &H4
    Const PRINTER_ENUM_FAVORITE = &H4
    Const PRINTER_ENUM_NAME = &H8
    Const PRINTER_ENUM_REMOTE = &H10
    Const PRINTER_ENUM_SHARED = &H20
    Const PRINTER_ENUM_NETWORK = &H40

    Const PRINTER_ENUM_EXPAND = &H4000
    Const PRINTER_ENUM_CONTAINER = &H8000

    Const PRINTER_ENUM_ICONMASK = &HFF0000
    Const PRINTER_ENUM_ICON1 = &H10000
    Const PRINTER_ENUM_ICON2 = &H20000
    Const PRINTER_ENUM_ICON3 = &H40000
    Const PRINTER_ENUM_ICON4 = &H80000
    Const PRINTER_ENUM_ICON5 = &H100000
    Const PRINTER_ENUM_ICON6 = &H200000
    Const PRINTER_ENUM_ICON7 = &H400000
    Const PRINTER_ENUM_ICON8 = &H800000

    Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
    Declare Function ResetPrinter Lib "winspool.drv" Alias "ResetPrinterA" (ByVal hPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long
    Declare Function SetJob Lib "winspool.drv" Alias "SetJobA" (ByVal hPrinter As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal Command As Long) As Long
    Declare Function GetJob Lib "winspool.drv" Alias "GetJobA" (ByVal hPrinter As Long, ByVal JobId As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
    Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
    Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" (ByVal pName As String, ByVal Level As Long, pPrinter As Any) As Long

    Declare Function AddPrinterDriver Lib "winspool.drv" Alias "AddPrinterDriverA" (ByVal pName As String, ByVal Level As Long, pDriverInfo As Any) As Long

    Declare Function EnumPrinterDrivers Lib "winspool.drv" Alias "EnumPrinterDriversA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pDriverInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcRetruned As Long) As Long
    Declare Function GetPrinterDriver Lib "winspool.drv" Alias "GetPrinterDriverA" (ByVal hPrinter As Long, ByVal pEnvironment As String, ByVal Level As Long, pDriverInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
    Declare Function GetPrinterDriverDirectory Lib "winspool.drv" Alias "GetPrinterDriverDirectoryA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pDriverDirectory As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
    Declare Function DeletePrinterDriver Lib "winspool.drv" Alias "DeletePrinterDriverA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pDriverName As String) As Long

    Declare Function AddPrintProcessor Lib "winspool.drv" Alias "AddPrintProcessorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pPathName As String, ByVal pPrintProcessorName As String) As Long
    Declare Function EnumPrintProcessors Lib "winspool.drv" Alias "EnumPrintProcessorsA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, pPrintProcessorInfo As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
    Declare Function GetPrintProcessorDirectory Lib "winspool.drv" Alias "GetPrintProcessorDirectoryA" (ByVal pName As String, ByVal pEnvironment As String, ByVal Level As Long, ByVal pPrintProcessorInfo As String, ByVal cdBuf As Long, pcbNeeded As Long) As Long
    Declare Function EnumPrintProcessorDatatypes Lib "winspool.drv" Alias "EnumPrintProcessorDatatypesA" (ByVal pName As String, ByVal pPrintProcessorName As String, ByVal Level As Long, pDatatypes As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcRetruned As Long) As Long
    Declare Function DeletePrintProcessor Lib "winspool.drv" Alias "DeletePrintProcessorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pPrintProcessorName As String) As Long

    Declare Function StartDocPrinter Lib "winspool.drv" Alias "StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pDocInfo As Byte) As Long
    Declare Function StartPagePrinter Lib "winspool.drv" Alias "StartPagePrinter" (ByVal hPrinter As Long) As Long
    Declare Function WritePrinter Lib "winspool.drv" Alias "WritePrinter" (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pcWritten As Long) As Long
    Declare Function EndPagePrinter Lib "winspool.drv" Alias "EndPagePrinter" (ByVal hPrinter As Long) As Long
    Declare Function AbortPrinter Lib "winspool.drv" Alias "AbortPrinter" (ByVal hPrinter As Long) As Long
    Declare Function ReadPrinter Lib "winspool.drv" Alias "ReadPrinter" (ByVal hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, pNoBytesRead As Long) As Long
    Declare Function EndDocPrinter Lib "winspool.drv" Alias "EndDocPrinter" (ByVal hPrinter As Long) As Long

    Declare Function AddJob Lib "winspool.drv" Alias "AddJobA" (ByVal hPrinter As Long, ByVal Level As Long, pData As Byte, ByVal cdBuf As Long, pcbNeeded As Long) As Long
    Declare Function ScheduleJob Lib "winspool.drv" Alias "ScheduleJob" (ByVal hPrinter As Long, ByVal JobId As Long) As Long
    Declare Function PrinterProperties Lib "winspool.drv" Alias "PrinterProperties" (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
    Declare Function DocumentProperties Lib "winspool.drv" Alias "DocumentPropertiesA" (ByVal hwnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As String, pDevModeOutput As DEVMODE, pDevModeInput As DEVMODE, ByVal fMode As Long) As Long
    Declare Function AdvancedDocumentProperties Lib "winspool.drv" Alias "AdvancedDocumentPropertiesA" (ByVal hwnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As String, pDevModeOutput As DEVMODE, pDevModeInput As DEVMODE) As Long

    Declare Function GetPrinterData Lib "winspool.drv" Alias "GetPrinterDataA" (ByVal hPrinter As Long, ByVal pValueName As String, pType As Long, pData As Byte, ByVal nSize As Long, pcbNeeded As Long) As Long
    Declare Function SetPrinterData Lib "winspool.drv" Alias "SetPrinterDataA" (ByVal hPrinter As Long, ByVal pValueName As String, ByVal dwType As Long, pData As Byte, ByVal cbData As Long) As Long
    Declare Function WaitForPrinterChange Lib "winspool.drv" Alias "WaitForPrinterChange" (ByVal hPrinter As Long, ByVal flags As Long) As Long

    Const PRINTER_CHANGE_ADD_PRINTER = &H1
    Const PRINTER_CHANGE_SET_PRINTER = &H2
    Const PRINTER_CHANGE_DELETE_PRINTER = &H4
    Const PRINTER_CHANGE_PRINTER = &HFF
    Const PRINTER_CHANGE_ADD_JOB = &H100
    Const PRINTER_CHANGE_SET_JOB = &H200
    Const PRINTER_CHANGE_DELETE_JOB = &H400
    Const PRINTER_CHANGE_WRITE_JOB = &H800
    Const PRINTER_CHANGE_JOB = &HFF00
    Const PRINTER_CHANGE_ADD_FORM = &H10000
    Const PRINTER_CHANGE_SET_FORM = &H20000
    Const PRINTER_CHANGE_DELETE_FORM = &H40000
    Const PRINTER_CHANGE_FORM = &H70000
    Const PRINTER_CHANGE_ADD_PORT = &H100000
    Const PRINTER_CHANGE_CONFIGURE_PORT = &H200000
    Const PRINTER_CHANGE_DELETE_PORT = &H400000
    Const PRINTER_CHANGE_PORT = &H700000
    Const PRINTER_CHANGE_ADD_PRINT_PROCESSOR = &H1000000
    Const PRINTER_CHANGE_DELETE_PRINT_PROCESSOR = &H4000000
    Const PRINTER_CHANGE_PRINT_PROCESSOR = &H7000000
    Const PRINTER_CHANGE_ADD_PRINTER_DRIVER = &H10000000
    Const PRINTER_CHANGE_DELETE_PRINTER_DRIVER = &H40000000
    Const PRINTER_CHANGE_PRINTER_DRIVER = &H70000000
    Const PRINTER_CHANGE_TIMEOUT = &H80000000
    Const PRINTER_CHANGE_ALL = &H7777FFFF

    Declare Function PrinterMessageBox Lib "winspool.drv" Alias "PrinterMessageBoxA" (ByVal hPrinter As Long, ByVal error As Long, ByVal hwnd As Long, ByVal pText As String, ByVal pCaption As String, ByVal dwType As Long) As Long

    Const PRINTER_ERROR_INFORMATION = &H80000000
    Const PRINTER_ERROR_WARNING = &H40000000
    Const PRINTER_ERROR_SEVERE = &H20000000

    Const PRINTER_ERROR_OUTOFPAPER = &H1
    Const PRINTER_ERROR_JAM = &H2
    Const PRINTER_ERROR_OUTOFTONER = &H4

    Declare Function ClosePrinter Lib "winspool.drv" Alias "ClosePrinter" (ByVal hPrinter As Long) As Long
    Declare Function AddForm Lib "winspool.drv" Alias "AddFormA" (ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte) As Long
    Declare Function DeleteForm Lib "winspool.drv" Alias "DeleteFormA" (ByVal hPrinter As Long, ByVal pFormName As String) As Long
    Declare Function GetForm Lib "winspool.drv" Alias "GetFormA" (ByVal hPrinter As Long, ByVal pFormName As String, ByVal Level As Long, pForm As Byte, ByVal cbBuf As Long, pcbNeeded As Long) As Long
    Declare Function SetForm Lib "winspool.drv" Alias "SetFormA" (ByVal hPrinter As Long, ByVal pFormName As String, ByVal Level As Long, pForm As Byte) As Long
    Declare Function EnumForms Lib "winspool.drv" Alias "EnumFormsA" (ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long

    Declare Function EnumMonitors Lib "winspool.drv" Alias "EnumMonitorsA" (ByVal pName As String, ByVal Level As Long, pMonitors As Byte, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
    Declare Function AddMonitor Lib "winspool.drv" Alias "AddMonitorA" (ByVal pName As String, ByVal Level As Long, pMonitors As Byte) As Long
    Declare Function DeleteMonitor Lib "winspool.drv" Alias "DeleteMonitorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pMonitorName As String) As Long

    Declare Function EnumPorts Lib "winspool.drv" Alias "EnumPortsA" (ByVal pName As String, ByVal Level As Long, ByVal lpbPorts As Long, ByVal cbBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
    Declare Function AddPort Lib "winspool.drv" Alias "AddPortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pMonitorName As String) As Long
    Declare Function ConfigurePort Lib "winspool.drv" Alias "ConfigurePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long
    Declare Function DeletePort Lib "winspool.drv" Alias "DeletePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long

    Declare Function AddPrinterConnection Lib "winspool.drv" Alias "AddPrinterConnectionA" (ByVal pName As String) As Long

    Declare Function DeletePrinterConnection Lib "winspool.drv" Alias "DeletePrinterConnectionA" (ByVal pName As String) As Long
    Declare Function ConnectToPrinterDlg Lib "winspool.drv" Alias "ConnectToPrinterDlg" (ByVal hwnd As Long, ByVal flags As Long) As Long

    Type PROVIDOR_INFO_1
    pName As String
    pEnvironment As String
    pDLLName As String
    End Type

    Declare Function AddPrintProvidor Lib "winspool.drv" Alias "AddPrintProvidorA" (ByVal pName As String, ByVal Level As Long, pProvidorInfo As Byte) As Long
    Declare Function DeletePrintProvidor Lib "winspool.drv" Alias "DeletePrintProvidorA" (ByVal pName As String, ByVal pEnvironment As String, ByVal pPrintProvidorName As String) As Long
     
    Für einen ist es Windows, für den anderen die größte Batch-Datei der Welt...

  5. #5
    Registriert seit
    Dec 2001
    Beiträge
    171
    hey..

    danke für deine apis!

    leider kann ich keine function finden, die den schacht ansteuert.. wäre für ein beispiel dankbar!

    greetings para
     
    Der Verstand und die Fähigkeit, ihn zu gebrauchen, sind zwei verschiedene Gaben!

  6. #6
    Registriert seit
    Jun 2002
    Ort
    Saarbrücken (Saarland)
    Beiträge
    9.886
    Blog-Einträge
    29
    Servus!

    Schau mal nach dem Objekt Printer

    Dim prn as Printer

    for each prn in Printers ...

    'Drucker suchen

    next prn

    prn.PaperBin = KONSTANTE


    Diese Eigenschaft gibt eine AcPrintPaperBin-Konstante zurück oder legt sie fest. Diese Konstante bestimmt den Papierschacht, den der angegebene Drucker verwenden soll. Mit Lese-/Schreibzugriff.

    AcPrintPaperBin kann einer der folgenden AcPrintPaperBin-Konstanten entsprechen.
    acPRBNAuto
    acPRBNCassette
    acPRBNEnvelope
    acPRBNEnvManual
    acPRBNFormSource
    acPRBNLargeCapacity
    acPRBNLargeFmt
    acPRBNLower
    acPRBNManual
    acPRBNMiddle
    acPRBNSmallFmt
    acPRBNTractor
    acPRBNUpper

    Ausdruck.PaperBin

    Ausdruck Erforderlich. Ein Ausdruck, der eines der Objekte in der Liste Betrifft zurückgibt.


    Gruß Tom
     
    Java rocks!
    How to become a good Java Programmer?
    Does IT in Java and .Net
    The only valid measurement of code quality: WTFs / minute
    Blog
    Xing
    Twitter

  7. #7
    Registriert seit
    Dec 2001
    Beiträge
    171
    hey..

    danke für die antwort!!

    leider kann ich deinen code so nicht verwenden, da ich den schacht mittels name angeben muss. geht nicht anders...

    gibts keine api befehle oder ev. sogar ein steuerelement dafür? habe schon das halbe internet durchsucht - erfolglos!

    greetings para
     
    Der Verstand und die Fähigkeit, ihn zu gebrauchen, sind zwei verschiedene Gaben!

Ähnliche Themen

  1. Log Printer Spool
    Von hagbard_celine im Forum .NET Café
    Antworten: 0
    Letzter Beitrag: 19.05.06, 12:58
  2. Printer
    Von Zero_Base im Forum .NET Café
    Antworten: 1
    Letzter Beitrag: 23.04.06, 20:57
  3. Common Dialog und Printer
    Von hkp im Forum Visual Basic 6.0
    Antworten: 4
    Letzter Beitrag: 06.02.06, 13:30
  4. Printer Objekt
    Von Dusty00 im Forum Visual Basic 6.0
    Antworten: 0
    Letzter Beitrag: 17.05.05, 22:09
  5. Set Default Printer
    Von pakko im Forum .NET Archiv
    Antworten: 0
    Letzter Beitrag: 11.05.05, 15:41