' 用紙サイズ関係の宣言
Public Const DM_PAPERSIZE = &H2&
Public Const DMPAPER_A3 = 8
Public Const DMPAPER_A4 = 9
Public Const DMPAPER_A4SMALL = 10
Public Const DMPAPER_A5 = 11
Public Const DMPAPER_B4 = 12
Public Const DMPAPER_B5 = 13
Public Const DMPAPER_JAPANESE_POSTCARD = 43
' 用紙の印刷方向関係の宣言
Public Const DM_ORIENTATION = &H1&
Public Const DMORIENT_PORTRAIT = 1
Public Const DMORIENT_LANDSCAPE = 2
' デバイス名の長さの宣言
Public Const CCHDEVICENAME = 32
' フォーム名の長さの宣言
Public Const CCHFORMNAME = 32
' プリンタアクセス権限の宣言
Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Public Const PRINTER_ACCESS_ADMINISTER = &H4&
Public Const PRINTER_ACCESS_USE = &H8&
Public Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or PRINTER_ACCESS_ADMINISTER Or _
PRINTER_ACCESS_USE)
' デバイス情報を定義する宣言
Type DEVMODE
dmDeviceName(CCHDEVICENAME - 1) As Byte
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName(CCHFORMNAME - 1) As Byte
dmLogPixels As Integer
dmBitsPerPel As Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
' プリンタアクセス権を定義する宣言
Type PRINTER_DEFAULTS
pDatatype As Long
pDevMode As Long
DesiredAccess As Long
End Type
' プリンタ情報を定義する宣言
Type PRINTER_INFO_2
pServerName As Long
pPrinterName As Long
pShareName As Long
pPortName As Long
pDriverName As Long
pComment As Long
pLocation As Long
pDevMode As Long
pSepFile As Long
pPrintProcessor As Long
pDatatype As Long
pParameters As Long
pSecurityDescriptor As Long
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
Status As Long
cJobs As Long
AveragePPM As Long
End Type
' プリンタオブジェクトを取得する関数の宣言
Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, _
phPrinter As Long, pDefault As Any) As Long
' プリンタオブジェクトを破棄する関数の宣言
Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
' プリンタ情報を取得する関数の宣言
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
' プリンタ情報を設定する関数の宣言
Declare Function SetPrinter Lib "winspool.drv" Alias "SetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, _
pPrinter As Any, ByVal Command As Long) As Long
' メモリブロックを移動する関数の宣言
Declare Sub MoveMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, _
ByVal Length As Long)