Win32 API 日本語リファレンス
ホームGraphics.Printing › FreePrinterNotifyInfo

FreePrinterNotifyInfo

関数
プリンター通知情報構造体のメモリを解放する。
DLLwinspool.drv呼出規約winapi

シグネチャ

// winspool.drv
#include <windows.h>

BOOL FreePrinterNotifyInfo(
    PRINTER_NOTIFY_INFO* pPrinterNotifyInfo
);

パラメーター

名前方向
pPrinterNotifyInfoPRINTER_NOTIFY_INFO*in

戻り値の型: BOOL

各言語での呼び出し定義

// winspool.drv
#include <windows.h>

BOOL FreePrinterNotifyInfo(
    PRINTER_NOTIFY_INFO* pPrinterNotifyInfo
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("winspool.drv", ExactSpelling = true)]
static extern bool FreePrinterNotifyInfo(
    IntPtr pPrinterNotifyInfo   // PRINTER_NOTIFY_INFO*
);
<DllImport("winspool.drv", ExactSpelling:=True)>
Public Shared Function FreePrinterNotifyInfo(
    pPrinterNotifyInfo As IntPtr   ' PRINTER_NOTIFY_INFO*
) As Boolean
End Function
' pPrinterNotifyInfo : PRINTER_NOTIFY_INFO*
Declare PtrSafe Function FreePrinterNotifyInfo Lib "winspool.drv" ( _
    ByVal pPrinterNotifyInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FreePrinterNotifyInfo = ctypes.windll.LoadLibrary("winspool.drv").FreePrinterNotifyInfo
FreePrinterNotifyInfo.restype = wintypes.BOOL
FreePrinterNotifyInfo.argtypes = [
    ctypes.c_void_p,  # pPrinterNotifyInfo : PRINTER_NOTIFY_INFO*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('winspool.drv')
FreePrinterNotifyInfo = Fiddle::Function.new(
  lib['FreePrinterNotifyInfo'],
  [
    Fiddle::TYPE_VOIDP,  # pPrinterNotifyInfo : PRINTER_NOTIFY_INFO*
  ],
  Fiddle::TYPE_INT)
#[link(name = "winspool.drv")]
extern "system" {
    fn FreePrinterNotifyInfo(
        pPrinterNotifyInfo: *mut PRINTER_NOTIFY_INFO  // PRINTER_NOTIFY_INFO*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("winspool.drv")]
public static extern bool FreePrinterNotifyInfo(IntPtr pPrinterNotifyInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winspool.drv_FreePrinterNotifyInfo' -Namespace Win32 -PassThru
# $api::FreePrinterNotifyInfo(pPrinterNotifyInfo)
#uselib "winspool.drv"
#func global FreePrinterNotifyInfo "FreePrinterNotifyInfo" sptr
; FreePrinterNotifyInfo varptr(pPrinterNotifyInfo)   ; 戻り値は stat
; pPrinterNotifyInfo : PRINTER_NOTIFY_INFO* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "winspool.drv"
#cfunc global FreePrinterNotifyInfo "FreePrinterNotifyInfo" var
; res = FreePrinterNotifyInfo(pPrinterNotifyInfo)
; pPrinterNotifyInfo : PRINTER_NOTIFY_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL FreePrinterNotifyInfo(PRINTER_NOTIFY_INFO* pPrinterNotifyInfo)
#uselib "winspool.drv"
#cfunc global FreePrinterNotifyInfo "FreePrinterNotifyInfo" var
; res = FreePrinterNotifyInfo(pPrinterNotifyInfo)
; pPrinterNotifyInfo : PRINTER_NOTIFY_INFO* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winspool_drv = windows.NewLazySystemDLL("winspool.drv")
	procFreePrinterNotifyInfo = winspool_drv.NewProc("FreePrinterNotifyInfo")
)

// pPrinterNotifyInfo (PRINTER_NOTIFY_INFO*)
r1, _, err := procFreePrinterNotifyInfo.Call(
	uintptr(pPrinterNotifyInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FreePrinterNotifyInfo(
  pPrinterNotifyInfo: Pointer   // PRINTER_NOTIFY_INFO*
): BOOL; stdcall;
  external 'winspool.drv' name 'FreePrinterNotifyInfo';
result := DllCall("winspool.drv\FreePrinterNotifyInfo"
    , "Ptr", pPrinterNotifyInfo   ; PRINTER_NOTIFY_INFO*
    , "Int")   ; return: BOOL
●FreePrinterNotifyInfo(pPrinterNotifyInfo) = DLL("winspool.drv", "bool FreePrinterNotifyInfo(void*)")
# 呼び出し: FreePrinterNotifyInfo(pPrinterNotifyInfo)
# pPrinterNotifyInfo : PRINTER_NOTIFY_INFO* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。