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