title image


Smiley Standarddrucker sollte so funktionieren...
Option Explicit

Private Declare Function GetProfileString Lib "kernel32" _

Alias "GetProfileStringA" (ByVal lpAppName As String, _

ByVal lpKeyName As String, ByVal lpDefault As String, _

ByVal lpReturnedString As String, ByVal nSize As Long) _

As Long



Private Sub CommandButton1_Click()

Dim PrinterName$, Driver$, Port$

Call GetStdPrinterName(PrinterName, Driver, Port)



MsgBox "Der Standarddrucker heißt: " & PrinterName & vbCrLf & "Der Treiber heißt: " & Driver & vbCrLf & "Es wird der Port benutzt: " & Port



End Sub



Private Sub GetStdPrinterName(PrinterName$, Driver$, Port$)

Dim Buffer$, r&, x&, y&



Buffer = Space(8192)

r = GetProfileString("windows", "Device", "", Buffer, Len(Buffer))

If r Then

Buffer = Mid(Buffer, 1, r)

x = InStr(Buffer, ",")

PrinterName = Mid(Buffer, 1, x - 1)

y = InStr(x + 1, Buffer, ",")

Driver = Mid(Buffer, x + 1, y - x - 1)

Port = Mid(Buffer, y + 1)

Else

PrinterName = ""

Driver = ""

Port = ""

End If

End Sub

Gruß aus Ostfriesland. Möge Tux mit Dir sein!

ff


Proggst du schon .net oder quälst du dich noch mit VB6?



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: