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

SetPolyFillMode

関数
多角形の塗りつぶしモードを設定する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

INT SetPolyFillMode(
    HDC hdc,
    CREATE_POLYGON_RGN_MODE mode
);

パラメーター

名前方向
hdcHDCin
modeCREATE_POLYGON_RGN_MODEin

戻り値の型: INT

各言語での呼び出し定義

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

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

SetPolyFillMode = ctypes.windll.gdi32.SetPolyFillMode
SetPolyFillMode.restype = ctypes.c_int
SetPolyFillMode.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_int,  # mode : CREATE_POLYGON_RGN_MODE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procSetPolyFillMode = gdi32.NewProc("SetPolyFillMode")
)

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