ホーム › Devices.Display › CLIPOBJ_bEnum
CLIPOBJ_bEnum
関数クリップオブジェクトのクリップ矩形を順に列挙する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL CLIPOBJ_bEnum(
CLIPOBJ* pco,
DWORD cj,
DWORD* pul
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pco | CLIPOBJ* | inout | 列挙対象のクリップ領域を記述する CLIPOBJ 構造体へのポインター。 |
| cj | DWORD | in | pv が指すバッファーのサイズをバイト単位で指定します。 |
| pul | DWORD* | inout | クリップ領域に関するデータを ENUMRECTS 構造体として受け取るバッファーへのポインター。 |
戻り値の型: BOOL
公式ドキュメント
CLIPOBJ_bEnum 関数は、指定したクリップ領域から矩形のバッチを列挙します。列挙の順序は、事前の CLIPOBJ_cEnumStart の呼び出しによって決定されます。
戻り値
ドライバーがさらに列挙データを取得するためにこの関数を再度呼び出す必要がある場合は TRUE、列挙が完了した場合は FALSE が戻り値となります。CLIPOBJ_bEnum がクリッピング矩形の数を 0 として TRUE を返すこともあります。その場合、ドライバーは何も処理を行わずに CLIPOBJ_bEnum を再度呼び出してください。
解説(Remarks)
この関数を呼び出す際のループ構造の例を次に示します。
do {
bMore = CLIPOBJ_bEnum(pco, sizeof(buffer), &buffer.c);
for (i = 0; i < buffer.c; i++) {
.
.
.
}
} while (bMore);
バッファーに書き込まれたオブジェクトの数は、バッファー自体に書き込まれます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL CLIPOBJ_bEnum(
CLIPOBJ* pco,
DWORD cj,
DWORD* pul
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool CLIPOBJ_bEnum(
IntPtr pco, // CLIPOBJ* in/out
uint cj, // DWORD
ref uint pul // DWORD* in/out
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function CLIPOBJ_bEnum(
pco As IntPtr, ' CLIPOBJ* in/out
cj As UInteger, ' DWORD
ByRef pul As UInteger ' DWORD* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pco : CLIPOBJ* in/out
' cj : DWORD
' pul : DWORD* in/out
Declare PtrSafe Function CLIPOBJ_bEnum Lib "gdi32" ( _
ByVal pco As LongPtr, _
ByVal cj As Long, _
ByRef pul As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CLIPOBJ_bEnum = ctypes.windll.gdi32.CLIPOBJ_bEnum
CLIPOBJ_bEnum.restype = wintypes.BOOL
CLIPOBJ_bEnum.argtypes = [
ctypes.c_void_p, # pco : CLIPOBJ* in/out
wintypes.DWORD, # cj : DWORD
ctypes.POINTER(wintypes.DWORD), # pul : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
CLIPOBJ_bEnum = Fiddle::Function.new(
lib['CLIPOBJ_bEnum'],
[
Fiddle::TYPE_VOIDP, # pco : CLIPOBJ* in/out
-Fiddle::TYPE_INT, # cj : DWORD
Fiddle::TYPE_VOIDP, # pul : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn CLIPOBJ_bEnum(
pco: *mut CLIPOBJ, // CLIPOBJ* in/out
cj: u32, // DWORD
pul: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool CLIPOBJ_bEnum(IntPtr pco, uint cj, ref uint pul);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_CLIPOBJ_bEnum' -Namespace Win32 -PassThru
# $api::CLIPOBJ_bEnum(pco, cj, pul)#uselib "GDI32.dll"
#func global CLIPOBJ_bEnum "CLIPOBJ_bEnum" sptr, sptr, sptr
; CLIPOBJ_bEnum varptr(pco), cj, varptr(pul) ; 戻り値は stat
; pco : CLIPOBJ* in/out -> "sptr"
; cj : DWORD -> "sptr"
; pul : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global CLIPOBJ_bEnum "CLIPOBJ_bEnum" var, int, var ; res = CLIPOBJ_bEnum(pco, cj, pul) ; pco : CLIPOBJ* in/out -> "var" ; cj : DWORD -> "int" ; pul : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global CLIPOBJ_bEnum "CLIPOBJ_bEnum" sptr, int, sptr ; res = CLIPOBJ_bEnum(varptr(pco), cj, varptr(pul)) ; pco : CLIPOBJ* in/out -> "sptr" ; cj : DWORD -> "int" ; pul : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL CLIPOBJ_bEnum(CLIPOBJ* pco, DWORD cj, DWORD* pul) #uselib "GDI32.dll" #cfunc global CLIPOBJ_bEnum "CLIPOBJ_bEnum" var, int, var ; res = CLIPOBJ_bEnum(pco, cj, pul) ; pco : CLIPOBJ* in/out -> "var" ; cj : DWORD -> "int" ; pul : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL CLIPOBJ_bEnum(CLIPOBJ* pco, DWORD cj, DWORD* pul) #uselib "GDI32.dll" #cfunc global CLIPOBJ_bEnum "CLIPOBJ_bEnum" intptr, int, intptr ; res = CLIPOBJ_bEnum(varptr(pco), cj, varptr(pul)) ; pco : CLIPOBJ* in/out -> "intptr" ; cj : DWORD -> "int" ; pul : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procCLIPOBJ_bEnum = gdi32.NewProc("CLIPOBJ_bEnum")
)
// pco (CLIPOBJ* in/out), cj (DWORD), pul (DWORD* in/out)
r1, _, err := procCLIPOBJ_bEnum.Call(
uintptr(pco),
uintptr(cj),
uintptr(pul),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction CLIPOBJ_bEnum(
pco: Pointer; // CLIPOBJ* in/out
cj: DWORD; // DWORD
pul: Pointer // DWORD* in/out
): BOOL; stdcall;
external 'GDI32.dll' name 'CLIPOBJ_bEnum';result := DllCall("GDI32\CLIPOBJ_bEnum"
, "Ptr", pco ; CLIPOBJ* in/out
, "UInt", cj ; DWORD
, "Ptr", pul ; DWORD* in/out
, "Int") ; return: BOOL●CLIPOBJ_bEnum(pco, cj, pul) = DLL("GDI32.dll", "bool CLIPOBJ_bEnum(void*, dword, void*)")
# 呼び出し: CLIPOBJ_bEnum(pco, cj, pul)
# pco : CLIPOBJ* in/out -> "void*"
# cj : DWORD -> "dword"
# pul : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdi32" fn CLIPOBJ_bEnum(
pco: [*c]CLIPOBJ, // CLIPOBJ* in/out
cj: u32, // DWORD
pul: [*c]u32 // DWORD* in/out
) callconv(std.os.windows.WINAPI) i32;proc CLIPOBJ_bEnum(
pco: ptr CLIPOBJ, # CLIPOBJ* in/out
cj: uint32, # DWORD
pul: ptr uint32 # DWORD* in/out
): int32 {.importc: "CLIPOBJ_bEnum", stdcall, dynlib: "GDI32.dll".}pragma(lib, "gdi32");
extern(Windows)
int CLIPOBJ_bEnum(
CLIPOBJ* pco, // CLIPOBJ* in/out
uint cj, // DWORD
uint* pul // DWORD* in/out
);ccall((:CLIPOBJ_bEnum, "GDI32.dll"), stdcall, Int32,
(Ptr{CLIPOBJ}, UInt32, Ptr{UInt32}),
pco, cj, pul)
# pco : CLIPOBJ* in/out -> Ptr{CLIPOBJ}
# cj : DWORD -> UInt32
# pul : DWORD* in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CLIPOBJ_bEnum(
void* pco,
uint32_t cj,
uint32_t* pul);
]]
local gdi32 = ffi.load("gdi32")
-- gdi32.CLIPOBJ_bEnum(pco, cj, pul)
-- pco : CLIPOBJ* in/out
-- cj : DWORD
-- pul : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('GDI32.dll');
const CLIPOBJ_bEnum = lib.func('__stdcall', 'CLIPOBJ_bEnum', 'int32_t', ['void *', 'uint32_t', 'uint32_t *']);
// CLIPOBJ_bEnum(pco, cj, pul)
// pco : CLIPOBJ* in/out -> 'void *'
// cj : DWORD -> 'uint32_t'
// pul : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("GDI32.dll", {
CLIPOBJ_bEnum: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.CLIPOBJ_bEnum(pco, cj, pul)
// pco : CLIPOBJ* in/out -> "pointer"
// cj : DWORD -> "u32"
// pul : DWORD* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CLIPOBJ_bEnum(
void* pco,
uint32_t cj,
uint32_t* pul);
C, "GDI32.dll");
// $ffi->CLIPOBJ_bEnum(pco, cj, pul);
// pco : CLIPOBJ* in/out
// cj : DWORD
// pul : DWORD* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Gdi32 extends StdCallLibrary {
Gdi32 INSTANCE = Native.load("gdi32", Gdi32.class);
boolean CLIPOBJ_bEnum(
Pointer pco, // CLIPOBJ* in/out
int cj, // DWORD
IntByReference pul // DWORD* in/out
);
}@[Link("gdi32")]
lib LibGDI32
fun CLIPOBJ_bEnum = CLIPOBJ_bEnum(
pco : CLIPOBJ*, # CLIPOBJ* in/out
cj : UInt32, # DWORD
pul : UInt32* # DWORD* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CLIPOBJ_bEnumNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Uint32>);
typedef CLIPOBJ_bEnumDart = int Function(Pointer<Void>, int, Pointer<Uint32>);
final CLIPOBJ_bEnum = DynamicLibrary.open('GDI32.dll')
.lookupFunction<CLIPOBJ_bEnumNative, CLIPOBJ_bEnumDart>('CLIPOBJ_bEnum');
// pco : CLIPOBJ* in/out -> Pointer<Void>
// cj : DWORD -> Uint32
// pul : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CLIPOBJ_bEnum(
pco: Pointer; // CLIPOBJ* in/out
cj: DWORD; // DWORD
pul: Pointer // DWORD* in/out
): BOOL; stdcall;
external 'GDI32.dll' name 'CLIPOBJ_bEnum';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CLIPOBJ_bEnum"
c_CLIPOBJ_bEnum :: Ptr () -> Word32 -> Ptr Word32 -> IO CInt
-- pco : CLIPOBJ* in/out -> Ptr ()
-- cj : DWORD -> Word32
-- pul : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let clipobj_benum =
foreign "CLIPOBJ_bEnum"
((ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* pco : CLIPOBJ* in/out -> (ptr void) *)
(* cj : DWORD -> uint32_t *)
(* pul : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdi32 (t "GDI32.dll"))
(cffi:use-foreign-library gdi32)
(cffi:defcfun ("CLIPOBJ_bEnum" clipobj-b-enum :convention :stdcall) :int32
(pco :pointer) ; CLIPOBJ* in/out
(cj :uint32) ; DWORD
(pul :pointer)) ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CLIPOBJ_bEnum = Win32::API::More->new('GDI32',
'BOOL CLIPOBJ_bEnum(LPVOID pco, DWORD cj, LPVOID pul)');
# my $ret = $CLIPOBJ_bEnum->Call($pco, $cj, $pul);
# pco : CLIPOBJ* in/out -> LPVOID
# cj : DWORD -> DWORD
# pul : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f CLIPOBJ_cEnumStart — クリップオブジェクトの領域列挙を開始する。
- s ENUMRECTS
使用する型