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

SelectClipPath

関数
現在のパスを既存のクリッピング領域と結合して選択する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL SelectClipPath(
    HDC hdc,
    RGN_COMBINE_MODE mode
);

パラメーター

名前方向
hdcHDCin
modeRGN_COMBINE_MODEin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SelectClipPath(
    HDC hdc,
    RGN_COMBINE_MODE mode
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool SelectClipPath(
    IntPtr hdc,   // HDC
    int mode   // RGN_COMBINE_MODE
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function SelectClipPath(
    hdc As IntPtr,   ' HDC
    mode As Integer   ' RGN_COMBINE_MODE
) As Boolean
End Function
' hdc : HDC
' mode : RGN_COMBINE_MODE
Declare PtrSafe Function SelectClipPath 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

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

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procSelectClipPath = gdi32.NewProc("SelectClipPath")
)

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