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

DrawEscape

関数
ビデオ表示用にドライバへ描画エスケープを送る。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

INT DrawEscape(
    HDC hdc,
    INT iEscape,
    INT cjIn,
    LPCSTR lpIn   // optional
);

パラメーター

名前方向
hdcHDCin
iEscapeINTin
cjInINTin
lpInLPCSTRinoptional

戻り値の型: INT

各言語での呼び出し定義

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

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

DrawEscape = ctypes.windll.gdi32.DrawEscape
DrawEscape.restype = ctypes.c_int
DrawEscape.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_int,  # iEscape : INT
    ctypes.c_int,  # cjIn : INT
    wintypes.LPCSTR,  # lpIn : LPCSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procDrawEscape = gdi32.NewProc("DrawEscape")
)

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