Attribute VB_Name = "basWinAPI"
Option Explicit

'プリンタ設定ダイアログボックスを表示する
Declare Function PrinterProperties Lib "winspool.drv" _
        (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
'プリンタあるいはプリントサーバーのハンドルを取得する
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

'// SHInvokePrinterCommand のアクションフラグ
Public Enum PRINTACTION_ENUM
    PRINTACTION_OPEN = 0                ' プリンタダイアログ
    PRINTACTION_PROPERTIES = 1          ' プロパティ
    PRINTACTION_NETINSTALL = 2
    PRINTACTION_NETINSTALLLINK = 3
    PRINTACTION_TESTPAGE = 4            ' テストページの印字 (なぜか動作しない...。) (T_T)
    PRINTACTION_OPENNETPRN = 5          ' ネットワークプロパティ
    ' 以下のアクションフラグは Windows NT or 2000 のみ
    PRINTACTION_DOCUMENTDEFAULTS = 6    ' ドキュメントの既定プロパティ
    PRINTACTION_SERVERPROPERTIES = 7    ' サーバーのプロパティ
End Enum

Declare Function SHInvokePrinterCommand _
    Lib "Shell32.dll" Alias "SHInvokePrinterCommandA" ( _
        ByVal hwnd As Long, _
        ByVal uAction As Long, _
        lpBuf1 As Byte, _
        ByVal lpBuf2 As String, _
        ByVal fModal As Long) As Long


'プリンタの用紙の取得
Public Declare Function DeviceCapabilities Lib "winspool.drv" _
    Alias "DeviceCapabilitiesA" (ByVal pDevice As String, _
    ByVal pPort As String, ByVal fwCapability As Long, _
    pOutput As Any, pDevMode As Any) As Long

Public Const DC_PAPERNAMES = 16

Public Declare Sub MoveMemory Lib "kernel32.dll" _
    Alias "RtlMoveMemory" (Destination As Any, _
    Source As Any, ByVal Length As Long)




