ホーム › Graphics.Gdi › EnumObjects
EnumObjects
関数デバイスコンテキスト内のペンやブラシを列挙する。
シグネチャ
// GDI32.dll
#include <windows.h>
INT EnumObjects(
HDC hdc,
OBJ_TYPE nType,
GOBJENUMPROC lpFunc,
LPARAM lParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| nType | OBJ_TYPE | in |
| lpFunc | GOBJENUMPROC | in |
| lParam | LPARAM | in |
戻り値の型: INT
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
INT EnumObjects(
HDC hdc,
OBJ_TYPE nType,
GOBJENUMPROC lpFunc,
LPARAM lParam
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern int EnumObjects(
IntPtr hdc, // HDC
int nType, // OBJ_TYPE
IntPtr lpFunc, // GOBJENUMPROC
IntPtr lParam // LPARAM
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function EnumObjects(
hdc As IntPtr, ' HDC
nType As Integer, ' OBJ_TYPE
lpFunc As IntPtr, ' GOBJENUMPROC
lParam As IntPtr ' LPARAM
) As Integer
End Function' hdc : HDC
' nType : OBJ_TYPE
' lpFunc : GOBJENUMPROC
' lParam : LPARAM
Declare PtrSafe Function EnumObjects Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal nType As Long, _
ByVal lpFunc As LongPtr, _
ByVal lParam As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EnumObjects = ctypes.windll.gdi32.EnumObjects
EnumObjects.restype = ctypes.c_int
EnumObjects.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_int, # nType : OBJ_TYPE
ctypes.c_void_p, # lpFunc : GOBJENUMPROC
ctypes.c_ssize_t, # lParam : LPARAM
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
EnumObjects = Fiddle::Function.new(
lib['EnumObjects'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_INT, # nType : OBJ_TYPE
Fiddle::TYPE_VOIDP, # lpFunc : GOBJENUMPROC
Fiddle::TYPE_INTPTR_T, # lParam : LPARAM
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn EnumObjects(
hdc: *mut core::ffi::c_void, // HDC
nType: i32, // OBJ_TYPE
lpFunc: *const core::ffi::c_void, // GOBJENUMPROC
lParam: isize // LPARAM
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern int EnumObjects(IntPtr hdc, int nType, IntPtr lpFunc, IntPtr lParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_EnumObjects' -Namespace Win32 -PassThru
# $api::EnumObjects(hdc, nType, lpFunc, lParam)#uselib "GDI32.dll"
#func global EnumObjects "EnumObjects" sptr, sptr, sptr, sptr
; EnumObjects hdc, nType, lpFunc, lParam ; 戻り値は stat
; hdc : HDC -> "sptr"
; nType : OBJ_TYPE -> "sptr"
; lpFunc : GOBJENUMPROC -> "sptr"
; lParam : LPARAM -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global EnumObjects "EnumObjects" sptr, int, sptr, sptr
; res = EnumObjects(hdc, nType, lpFunc, lParam)
; hdc : HDC -> "sptr"
; nType : OBJ_TYPE -> "int"
; lpFunc : GOBJENUMPROC -> "sptr"
; lParam : LPARAM -> "sptr"; INT EnumObjects(HDC hdc, OBJ_TYPE nType, GOBJENUMPROC lpFunc, LPARAM lParam)
#uselib "GDI32.dll"
#cfunc global EnumObjects "EnumObjects" intptr, int, intptr, intptr
; res = EnumObjects(hdc, nType, lpFunc, lParam)
; hdc : HDC -> "intptr"
; nType : OBJ_TYPE -> "int"
; lpFunc : GOBJENUMPROC -> "intptr"
; lParam : LPARAM -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procEnumObjects = gdi32.NewProc("EnumObjects")
)
// hdc (HDC), nType (OBJ_TYPE), lpFunc (GOBJENUMPROC), lParam (LPARAM)
r1, _, err := procEnumObjects.Call(
uintptr(hdc),
uintptr(nType),
uintptr(lpFunc),
uintptr(lParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction EnumObjects(
hdc: THandle; // HDC
nType: Integer; // OBJ_TYPE
lpFunc: Pointer; // GOBJENUMPROC
lParam: NativeInt // LPARAM
): Integer; stdcall;
external 'GDI32.dll' name 'EnumObjects';result := DllCall("GDI32\EnumObjects"
, "Ptr", hdc ; HDC
, "Int", nType ; OBJ_TYPE
, "Ptr", lpFunc ; GOBJENUMPROC
, "Ptr", lParam ; LPARAM
, "Int") ; return: INT●EnumObjects(hdc, nType, lpFunc, lParam) = DLL("GDI32.dll", "int EnumObjects(void*, int, void*, int)")
# 呼び出し: EnumObjects(hdc, nType, lpFunc, lParam)
# hdc : HDC -> "void*"
# nType : OBJ_TYPE -> "int"
# lpFunc : GOBJENUMPROC -> "void*"
# lParam : LPARAM -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。