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