ホーム › Storage.Xps › Escape
Escape
関数デバイス固有の機能にアクセスするためのエスケープ命令を送る。
シグネチャ
// GDI32.dll
#include <windows.h>
INT Escape(
HDC hdc,
INT iEscape,
INT cjIn,
LPCSTR pvIn, // optional
void* pvOut // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| iEscape | INT | in |
| cjIn | INT | in |
| pvIn | LPCSTR | inoptional |
| pvOut | void* | outoptional |
戻り値の型: INT
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
INT Escape(
HDC hdc,
INT iEscape,
INT cjIn,
LPCSTR pvIn, // optional
void* pvOut // optional
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern int Escape(
IntPtr hdc, // HDC
int iEscape, // INT
int cjIn, // INT
[MarshalAs(UnmanagedType.LPStr)] string pvIn, // LPCSTR optional
IntPtr pvOut // void* optional, out
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function Escape(
hdc As IntPtr, ' HDC
iEscape As Integer, ' INT
cjIn As Integer, ' INT
<MarshalAs(UnmanagedType.LPStr)> pvIn As String, ' LPCSTR optional
pvOut As IntPtr ' void* optional, out
) As Integer
End Function' hdc : HDC
' iEscape : INT
' cjIn : INT
' pvIn : LPCSTR optional
' pvOut : void* optional, out
Declare PtrSafe Function Escape Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal iEscape As Long, _
ByVal cjIn As Long, _
ByVal pvIn As String, _
ByVal pvOut As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
Escape = ctypes.windll.gdi32.Escape
Escape.restype = ctypes.c_int
Escape.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_int, # iEscape : INT
ctypes.c_int, # cjIn : INT
wintypes.LPCSTR, # pvIn : LPCSTR optional
ctypes.POINTER(None), # pvOut : void* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
Escape = Fiddle::Function.new(
lib['Escape'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_INT, # iEscape : INT
Fiddle::TYPE_INT, # cjIn : INT
Fiddle::TYPE_VOIDP, # pvIn : LPCSTR optional
Fiddle::TYPE_VOIDP, # pvOut : void* optional, out
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn Escape(
hdc: *mut core::ffi::c_void, // HDC
iEscape: i32, // INT
cjIn: i32, // INT
pvIn: *const u8, // LPCSTR optional
pvOut: *mut () // void* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern int Escape(IntPtr hdc, int iEscape, int cjIn, [MarshalAs(UnmanagedType.LPStr)] string pvIn, IntPtr pvOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_Escape' -Namespace Win32 -PassThru
# $api::Escape(hdc, iEscape, cjIn, pvIn, pvOut)#uselib "GDI32.dll"
#func global Escape "Escape" sptr, sptr, sptr, sptr, sptr
; Escape hdc, iEscape, cjIn, pvIn, pvOut ; 戻り値は stat
; hdc : HDC -> "sptr"
; iEscape : INT -> "sptr"
; cjIn : INT -> "sptr"
; pvIn : LPCSTR optional -> "sptr"
; pvOut : void* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global Escape "Escape" sptr, int, int, str, sptr
; res = Escape(hdc, iEscape, cjIn, pvIn, pvOut)
; hdc : HDC -> "sptr"
; iEscape : INT -> "int"
; cjIn : INT -> "int"
; pvIn : LPCSTR optional -> "str"
; pvOut : void* optional, out -> "sptr"; INT Escape(HDC hdc, INT iEscape, INT cjIn, LPCSTR pvIn, void* pvOut)
#uselib "GDI32.dll"
#cfunc global Escape "Escape" intptr, int, int, str, intptr
; res = Escape(hdc, iEscape, cjIn, pvIn, pvOut)
; hdc : HDC -> "intptr"
; iEscape : INT -> "int"
; cjIn : INT -> "int"
; pvIn : LPCSTR optional -> "str"
; pvOut : void* optional, out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procEscape = gdi32.NewProc("Escape")
)
// hdc (HDC), iEscape (INT), cjIn (INT), pvIn (LPCSTR optional), pvOut (void* optional, out)
r1, _, err := procEscape.Call(
uintptr(hdc),
uintptr(iEscape),
uintptr(cjIn),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pvIn))),
uintptr(pvOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction Escape(
hdc: THandle; // HDC
iEscape: Integer; // INT
cjIn: Integer; // INT
pvIn: PAnsiChar; // LPCSTR optional
pvOut: Pointer // void* optional, out
): Integer; stdcall;
external 'GDI32.dll' name 'Escape';result := DllCall("GDI32\Escape"
, "Ptr", hdc ; HDC
, "Int", iEscape ; INT
, "Int", cjIn ; INT
, "AStr", pvIn ; LPCSTR optional
, "Ptr", pvOut ; void* optional, out
, "Int") ; return: INT●Escape(hdc, iEscape, cjIn, pvIn, pvOut) = DLL("GDI32.dll", "int Escape(void*, int, int, char*, void*)")
# 呼び出し: Escape(hdc, iEscape, cjIn, pvIn, pvOut)
# hdc : HDC -> "void*"
# iEscape : INT -> "int"
# cjIn : INT -> "int"
# pvIn : LPCSTR optional -> "char*"
# pvOut : void* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。