Übers API gibt es scheinbar eine Möglichkeit, den Standarddrucker abzufragen :
Sometimes it is necessary to know which is the predetermined printer, to send the impression. With the use of this code will be able to send to the printer
by default or to take this for some I use in particular.
Code
Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (Byval hKey As Long, Byval lpSubKey As String, Byval dwReserved As Long, Byval samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (Byval hKey As Long, Byval lpValueName$, Byval lpdwReserved As Long, lpdwType As Long, lpData As Any, lpcbData As Long) As Long
Declare Function RegCloseKey Lib "advapi32" (Byval hKey As Long) As Long
Sub Click(Source As Button)
Dim PName As String
Dim WorkSpace As New NotesUIWorkSpace
Dim UIDoc As NotesUIDocument
Dim Doc As NotesDocument
Set UIDoc = WorkSpace.CurrentDocument
Set Doc = UIDoc.Document
Doc.txtPrinterDefault = GetCurrPrinter()
End Sub
Function GetCurrPrinter() As String
Const HKEY_CURRENT_CONFIG = &H80000005
GetCurrPrinter = RegGetString$(HKEY_CURRENT_CONFIG,
"System\CurrentControlSet\Control\Print\Printers", "Default")
End Function
Function RegGetString$(hInKey As Long, Byval subkey$, Byval valname$)
Dim RetVal$, hSubKey As Long, dwType As Long, SZ As Long
Dim R As Long
RetVal$ = ""
Const KEY_ALL_ACCESS = 0
Const ERROR_SUCCESS = 0
Const REG_SZ = 1
R = RegOpenKeyEx(hInKey, subkey$, 0, KEY_ALL_ACCESS, hSubKey)
If R <> ERROR_SUCCESS Then Goto Quit_Now
SZ = 256
v$ = String$(SZ, 0)
R = RegQueryValueEx(hSubKey, valname$, 0, dwType, Byval v$, SZ)
If R = ERROR_SUCCESS And dwType = REG_SZ Then
RetVal$ = Left$(v$, SZ)
Else
RetVal$ = "--Not String--"
End If
If hInKey = 0 Then R = RegCloseKey(hSubKey)
Quit_Now:
RegGetString$ = RetVal$
End Function