' Autore: Bracchi Enzo
' Ritorna: il nome della stampante predefinita
Private Declare Function GetProfileString Lib "Kernel32.dll" _
Alias "GetProfileStringA" (ByVal lpAppName As String, _
ByVal lpKeyName As String, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Public Function GetDefaultPrinter() As String
Dim x As Long, szTmp As String, dwBuf As Long
dwBuf = 1024
szTmp = Space(dwBuf + 1)
x = GetProfileString("windows", "device", "", szTmp, dwBuf)
GetDefaultPrinter = Trim(Left(szTmp, x))
End Function
|