ホーム › Graphics.Printing › GdiResetDCEMF
GdiResetDCEMF
関数EMFスプールのデバイスコンテキストをDEVMODEで再設定する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL GdiResetDCEMF(
HANDLE SpoolFileHandle,
DEVMODEW* pCurrDM
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| SpoolFileHandle | HANDLE | in |
| pCurrDM | DEVMODEW* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL GdiResetDCEMF(
HANDLE SpoolFileHandle,
DEVMODEW* pCurrDM
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool GdiResetDCEMF(
IntPtr SpoolFileHandle, // HANDLE
IntPtr pCurrDM // DEVMODEW* in/out
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function GdiResetDCEMF(
SpoolFileHandle As IntPtr, ' HANDLE
pCurrDM As IntPtr ' DEVMODEW* in/out
) As Boolean
End Function' SpoolFileHandle : HANDLE
' pCurrDM : DEVMODEW* in/out
Declare PtrSafe Function GdiResetDCEMF Lib "gdi32" ( _
ByVal SpoolFileHandle As LongPtr, _
ByVal pCurrDM As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdiResetDCEMF = ctypes.windll.gdi32.GdiResetDCEMF
GdiResetDCEMF.restype = wintypes.BOOL
GdiResetDCEMF.argtypes = [
wintypes.HANDLE, # SpoolFileHandle : HANDLE
ctypes.c_void_p, # pCurrDM : DEVMODEW* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
GdiResetDCEMF = Fiddle::Function.new(
lib['GdiResetDCEMF'],
[
Fiddle::TYPE_VOIDP, # SpoolFileHandle : HANDLE
Fiddle::TYPE_VOIDP, # pCurrDM : DEVMODEW* in/out
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn GdiResetDCEMF(
SpoolFileHandle: *mut core::ffi::c_void, // HANDLE
pCurrDM: *mut DEVMODEW // DEVMODEW* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool GdiResetDCEMF(IntPtr SpoolFileHandle, IntPtr pCurrDM);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GdiResetDCEMF' -Namespace Win32 -PassThru
# $api::GdiResetDCEMF(SpoolFileHandle, pCurrDM)#uselib "GDI32.dll"
#func global GdiResetDCEMF "GdiResetDCEMF" sptr, sptr
; GdiResetDCEMF SpoolFileHandle, varptr(pCurrDM) ; 戻り値は stat
; SpoolFileHandle : HANDLE -> "sptr"
; pCurrDM : DEVMODEW* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global GdiResetDCEMF "GdiResetDCEMF" sptr, var ; res = GdiResetDCEMF(SpoolFileHandle, pCurrDM) ; SpoolFileHandle : HANDLE -> "sptr" ; pCurrDM : DEVMODEW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global GdiResetDCEMF "GdiResetDCEMF" sptr, sptr ; res = GdiResetDCEMF(SpoolFileHandle, varptr(pCurrDM)) ; SpoolFileHandle : HANDLE -> "sptr" ; pCurrDM : DEVMODEW* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GdiResetDCEMF(HANDLE SpoolFileHandle, DEVMODEW* pCurrDM) #uselib "GDI32.dll" #cfunc global GdiResetDCEMF "GdiResetDCEMF" intptr, var ; res = GdiResetDCEMF(SpoolFileHandle, pCurrDM) ; SpoolFileHandle : HANDLE -> "intptr" ; pCurrDM : DEVMODEW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GdiResetDCEMF(HANDLE SpoolFileHandle, DEVMODEW* pCurrDM) #uselib "GDI32.dll" #cfunc global GdiResetDCEMF "GdiResetDCEMF" intptr, intptr ; res = GdiResetDCEMF(SpoolFileHandle, varptr(pCurrDM)) ; SpoolFileHandle : HANDLE -> "intptr" ; pCurrDM : DEVMODEW* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procGdiResetDCEMF = gdi32.NewProc("GdiResetDCEMF")
)
// SpoolFileHandle (HANDLE), pCurrDM (DEVMODEW* in/out)
r1, _, err := procGdiResetDCEMF.Call(
uintptr(SpoolFileHandle),
uintptr(pCurrDM),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GdiResetDCEMF(
SpoolFileHandle: THandle; // HANDLE
pCurrDM: Pointer // DEVMODEW* in/out
): BOOL; stdcall;
external 'GDI32.dll' name 'GdiResetDCEMF';result := DllCall("GDI32\GdiResetDCEMF"
, "Ptr", SpoolFileHandle ; HANDLE
, "Ptr", pCurrDM ; DEVMODEW* in/out
, "Int") ; return: BOOL●GdiResetDCEMF(SpoolFileHandle, pCurrDM) = DLL("GDI32.dll", "bool GdiResetDCEMF(void*, void*)")
# 呼び出し: GdiResetDCEMF(SpoolFileHandle, pCurrDM)
# SpoolFileHandle : HANDLE -> "void*"
# pCurrDM : DEVMODEW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。