Win32 API 日本語リファレンス
ホームStorage.Xps › SetAbortProc

SetAbortProc

関数
印刷ジョブの中止可否を判定するコールバック関数を登録する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll
#include <windows.h>

INT SetAbortProc(
    HDC hdc,
    ABORTPROC proc
);

パラメーター

名前方向
hdcHDCin
procABORTPROCin

戻り値の型: INT

各言語での呼び出し定義

// GDI32.dll
#include <windows.h>

INT SetAbortProc(
    HDC hdc,
    ABORTPROC proc
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern int SetAbortProc(
    IntPtr hdc,   // HDC
    IntPtr proc   // ABORTPROC
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function SetAbortProc(
    hdc As IntPtr,   ' HDC
    proc As IntPtr   ' ABORTPROC
) As Integer
End Function
' hdc : HDC
' proc : ABORTPROC
Declare PtrSafe Function SetAbortProc Lib "gdi32" ( _
    ByVal hdc As LongPtr, _
    ByVal proc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetAbortProc = ctypes.windll.gdi32.SetAbortProc
SetAbortProc.restype = ctypes.c_int
SetAbortProc.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_void_p,  # proc : ABORTPROC
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
SetAbortProc = Fiddle::Function.new(
  lib['SetAbortProc'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
    Fiddle::TYPE_VOIDP,  # proc : ABORTPROC
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn SetAbortProc(
        hdc: *mut core::ffi::c_void,  // HDC
        proc: *const core::ffi::c_void  // ABORTPROC
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GDI32.dll")]
public static extern int SetAbortProc(IntPtr hdc, IntPtr proc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_SetAbortProc' -Namespace Win32 -PassThru
# $api::SetAbortProc(hdc, proc)
#uselib "GDI32.dll"
#func global SetAbortProc "SetAbortProc" sptr, sptr
; SetAbortProc hdc, proc   ; 戻り値は stat
; hdc : HDC -> "sptr"
; proc : ABORTPROC -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global SetAbortProc "SetAbortProc" sptr, sptr
; res = SetAbortProc(hdc, proc)
; hdc : HDC -> "sptr"
; proc : ABORTPROC -> "sptr"
; INT SetAbortProc(HDC hdc, ABORTPROC proc)
#uselib "GDI32.dll"
#cfunc global SetAbortProc "SetAbortProc" intptr, intptr
; res = SetAbortProc(hdc, proc)
; hdc : HDC -> "intptr"
; proc : ABORTPROC -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procSetAbortProc = gdi32.NewProc("SetAbortProc")
)

// hdc (HDC), proc (ABORTPROC)
r1, _, err := procSetAbortProc.Call(
	uintptr(hdc),
	uintptr(proc),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function SetAbortProc(
  hdc: THandle;   // HDC
  proc: Pointer   // ABORTPROC
): Integer; stdcall;
  external 'GDI32.dll' name 'SetAbortProc';
result := DllCall("GDI32\SetAbortProc"
    , "Ptr", hdc   ; HDC
    , "Ptr", proc   ; ABORTPROC
    , "Int")   ; return: INT
●SetAbortProc(hdc, proc) = DLL("GDI32.dll", "int SetAbortProc(void*, void*)")
# 呼び出し: SetAbortProc(hdc, proc)
# hdc : HDC -> "void*"
# proc : ABORTPROC -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。