ホーム › Graphics.Printing › DeletePrinterDriverPackageA
DeletePrinterDriverPackageA
関数指定のプリンタードライバーパッケージを削除する。
シグネチャ
// winspool.drv (ANSI / -A)
#include <windows.h>
HRESULT DeletePrinterDriverPackageA(
LPCSTR pszServer, // optional
LPCSTR pszInfPath,
LPCSTR pszEnvironment // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszServer | LPCSTR | inoptional |
| pszInfPath | LPCSTR | in |
| pszEnvironment | LPCSTR | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// winspool.drv (ANSI / -A)
#include <windows.h>
HRESULT DeletePrinterDriverPackageA(
LPCSTR pszServer, // optional
LPCSTR pszInfPath,
LPCSTR pszEnvironment // optional
);[DllImport("winspool.drv", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int DeletePrinterDriverPackageA(
[MarshalAs(UnmanagedType.LPStr)] string pszServer, // LPCSTR optional
[MarshalAs(UnmanagedType.LPStr)] string pszInfPath, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string pszEnvironment // LPCSTR optional
);<DllImport("winspool.drv", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DeletePrinterDriverPackageA(
<MarshalAs(UnmanagedType.LPStr)> pszServer As String, ' LPCSTR optional
<MarshalAs(UnmanagedType.LPStr)> pszInfPath As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> pszEnvironment As String ' LPCSTR optional
) As Integer
End Function' pszServer : LPCSTR optional
' pszInfPath : LPCSTR
' pszEnvironment : LPCSTR optional
Declare PtrSafe Function DeletePrinterDriverPackageA Lib "winspool.drv" ( _
ByVal pszServer As String, _
ByVal pszInfPath As String, _
ByVal pszEnvironment As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DeletePrinterDriverPackageA = ctypes.windll.LoadLibrary("winspool.drv").DeletePrinterDriverPackageA
DeletePrinterDriverPackageA.restype = ctypes.c_int
DeletePrinterDriverPackageA.argtypes = [
wintypes.LPCSTR, # pszServer : LPCSTR optional
wintypes.LPCSTR, # pszInfPath : LPCSTR
wintypes.LPCSTR, # pszEnvironment : LPCSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('winspool.drv')
DeletePrinterDriverPackageA = Fiddle::Function.new(
lib['DeletePrinterDriverPackageA'],
[
Fiddle::TYPE_VOIDP, # pszServer : LPCSTR optional
Fiddle::TYPE_VOIDP, # pszInfPath : LPCSTR
Fiddle::TYPE_VOIDP, # pszEnvironment : LPCSTR optional
],
Fiddle::TYPE_INT)#[link(name = "winspool.drv")]
extern "system" {
fn DeletePrinterDriverPackageA(
pszServer: *const u8, // LPCSTR optional
pszInfPath: *const u8, // LPCSTR
pszEnvironment: *const u8 // LPCSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("winspool.drv", CharSet = CharSet.Ansi)]
public static extern int DeletePrinterDriverPackageA([MarshalAs(UnmanagedType.LPStr)] string pszServer, [MarshalAs(UnmanagedType.LPStr)] string pszInfPath, [MarshalAs(UnmanagedType.LPStr)] string pszEnvironment);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winspool.drv_DeletePrinterDriverPackageA' -Namespace Win32 -PassThru
# $api::DeletePrinterDriverPackageA(pszServer, pszInfPath, pszEnvironment)#uselib "winspool.drv"
#func global DeletePrinterDriverPackageA "DeletePrinterDriverPackageA" sptr, sptr, sptr
; DeletePrinterDriverPackageA pszServer, pszInfPath, pszEnvironment ; 戻り値は stat
; pszServer : LPCSTR optional -> "sptr"
; pszInfPath : LPCSTR -> "sptr"
; pszEnvironment : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "winspool.drv"
#cfunc global DeletePrinterDriverPackageA "DeletePrinterDriverPackageA" str, str, str
; res = DeletePrinterDriverPackageA(pszServer, pszInfPath, pszEnvironment)
; pszServer : LPCSTR optional -> "str"
; pszInfPath : LPCSTR -> "str"
; pszEnvironment : LPCSTR optional -> "str"; HRESULT DeletePrinterDriverPackageA(LPCSTR pszServer, LPCSTR pszInfPath, LPCSTR pszEnvironment)
#uselib "winspool.drv"
#cfunc global DeletePrinterDriverPackageA "DeletePrinterDriverPackageA" str, str, str
; res = DeletePrinterDriverPackageA(pszServer, pszInfPath, pszEnvironment)
; pszServer : LPCSTR optional -> "str"
; pszInfPath : LPCSTR -> "str"
; pszEnvironment : LPCSTR optional -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winspool_drv = windows.NewLazySystemDLL("winspool.drv")
procDeletePrinterDriverPackageA = winspool_drv.NewProc("DeletePrinterDriverPackageA")
)
// pszServer (LPCSTR optional), pszInfPath (LPCSTR), pszEnvironment (LPCSTR optional)
r1, _, err := procDeletePrinterDriverPackageA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszServer))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszInfPath))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszEnvironment))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DeletePrinterDriverPackageA(
pszServer: PAnsiChar; // LPCSTR optional
pszInfPath: PAnsiChar; // LPCSTR
pszEnvironment: PAnsiChar // LPCSTR optional
): Integer; stdcall;
external 'winspool.drv' name 'DeletePrinterDriverPackageA';result := DllCall("winspool.drv\DeletePrinterDriverPackageA"
, "AStr", pszServer ; LPCSTR optional
, "AStr", pszInfPath ; LPCSTR
, "AStr", pszEnvironment ; LPCSTR optional
, "Int") ; return: HRESULT●DeletePrinterDriverPackageA(pszServer, pszInfPath, pszEnvironment) = DLL("winspool.drv", "int DeletePrinterDriverPackageA(char*, char*, char*)")
# 呼び出し: DeletePrinterDriverPackageA(pszServer, pszInfPath, pszEnvironment)
# pszServer : LPCSTR optional -> "char*"
# pszInfPath : LPCSTR -> "char*"
# pszEnvironment : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。