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

CreatePolyPolygonRgn

関数
複数の多角形からなる領域を作成する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRGN CreatePolyPolygonRgn(
    const POINT* pptl,
    const INT* pc,
    INT cPoly,
    CREATE_POLYGON_RGN_MODE iMode
);

パラメーター

名前方向
pptlPOINT*in
pcINT*in
cPolyINTin
iModeCREATE_POLYGON_RGN_MODEin

戻り値の型: HRGN

各言語での呼び出し定義

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

HRGN CreatePolyPolygonRgn(
    const POINT* pptl,
    const INT* pc,
    INT cPoly,
    CREATE_POLYGON_RGN_MODE iMode
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr CreatePolyPolygonRgn(
    IntPtr pptl,   // POINT*
    ref int pc,   // INT*
    int cPoly,   // INT
    int iMode   // CREATE_POLYGON_RGN_MODE
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function CreatePolyPolygonRgn(
    pptl As IntPtr,   ' POINT*
    ByRef pc As Integer,   ' INT*
    cPoly As Integer,   ' INT
    iMode As Integer   ' CREATE_POLYGON_RGN_MODE
) As IntPtr
End Function
' pptl : POINT*
' pc : INT*
' cPoly : INT
' iMode : CREATE_POLYGON_RGN_MODE
Declare PtrSafe Function CreatePolyPolygonRgn Lib "gdi32" ( _
    ByVal pptl As LongPtr, _
    ByRef pc As Long, _
    ByVal cPoly As Long, _
    ByVal iMode As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreatePolyPolygonRgn = ctypes.windll.gdi32.CreatePolyPolygonRgn
CreatePolyPolygonRgn.restype = ctypes.c_void_p
CreatePolyPolygonRgn.argtypes = [
    ctypes.c_void_p,  # pptl : POINT*
    ctypes.POINTER(ctypes.c_int),  # pc : INT*
    ctypes.c_int,  # cPoly : INT
    ctypes.c_int,  # iMode : CREATE_POLYGON_RGN_MODE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
CreatePolyPolygonRgn = Fiddle::Function.new(
  lib['CreatePolyPolygonRgn'],
  [
    Fiddle::TYPE_VOIDP,  # pptl : POINT*
    Fiddle::TYPE_VOIDP,  # pc : INT*
    Fiddle::TYPE_INT,  # cPoly : INT
    Fiddle::TYPE_INT,  # iMode : CREATE_POLYGON_RGN_MODE
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "gdi32")]
extern "system" {
    fn CreatePolyPolygonRgn(
        pptl: *const POINT,  // POINT*
        pc: *const i32,  // INT*
        cPoly: i32,  // INT
        iMode: i32  // CREATE_POLYGON_RGN_MODE
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GDI32.dll")]
public static extern IntPtr CreatePolyPolygonRgn(IntPtr pptl, ref int pc, int cPoly, int iMode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_CreatePolyPolygonRgn' -Namespace Win32 -PassThru
# $api::CreatePolyPolygonRgn(pptl, pc, cPoly, iMode)
#uselib "GDI32.dll"
#func global CreatePolyPolygonRgn "CreatePolyPolygonRgn" sptr, sptr, sptr, sptr
; CreatePolyPolygonRgn varptr(pptl), varptr(pc), cPoly, iMode   ; 戻り値は stat
; pptl : POINT* -> "sptr"
; pc : INT* -> "sptr"
; cPoly : INT -> "sptr"
; iMode : CREATE_POLYGON_RGN_MODE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "GDI32.dll"
#cfunc global CreatePolyPolygonRgn "CreatePolyPolygonRgn" var, var, int, int
; res = CreatePolyPolygonRgn(pptl, pc, cPoly, iMode)
; pptl : POINT* -> "var"
; pc : INT* -> "var"
; cPoly : INT -> "int"
; iMode : CREATE_POLYGON_RGN_MODE -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRGN CreatePolyPolygonRgn(POINT* pptl, INT* pc, INT cPoly, CREATE_POLYGON_RGN_MODE iMode)
#uselib "GDI32.dll"
#cfunc global CreatePolyPolygonRgn "CreatePolyPolygonRgn" var, var, int, int
; res = CreatePolyPolygonRgn(pptl, pc, cPoly, iMode)
; pptl : POINT* -> "var"
; pc : INT* -> "var"
; cPoly : INT -> "int"
; iMode : CREATE_POLYGON_RGN_MODE -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procCreatePolyPolygonRgn = gdi32.NewProc("CreatePolyPolygonRgn")
)

// pptl (POINT*), pc (INT*), cPoly (INT), iMode (CREATE_POLYGON_RGN_MODE)
r1, _, err := procCreatePolyPolygonRgn.Call(
	uintptr(pptl),
	uintptr(pc),
	uintptr(cPoly),
	uintptr(iMode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRGN
function CreatePolyPolygonRgn(
  pptl: Pointer;   // POINT*
  pc: Pointer;   // INT*
  cPoly: Integer;   // INT
  iMode: Integer   // CREATE_POLYGON_RGN_MODE
): THandle; stdcall;
  external 'GDI32.dll' name 'CreatePolyPolygonRgn';
result := DllCall("GDI32\CreatePolyPolygonRgn"
    , "Ptr", pptl   ; POINT*
    , "Ptr", pc   ; INT*
    , "Int", cPoly   ; INT
    , "Int", iMode   ; CREATE_POLYGON_RGN_MODE
    , "Ptr")   ; return: HRGN
●CreatePolyPolygonRgn(pptl, pc, cPoly, iMode) = DLL("GDI32.dll", "void* CreatePolyPolygonRgn(void*, void*, int, int)")
# 呼び出し: CreatePolyPolygonRgn(pptl, pc, cPoly, iMode)
# pptl : POINT* -> "void*"
# pc : INT* -> "void*"
# cPoly : INT -> "int"
# iMode : CREATE_POLYGON_RGN_MODE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。