ホーム › UI.Controls › ImageList_GetIconSize
ImageList_GetIconSize
関数イメージリストの画像の縦横サイズを取得する。
シグネチャ
// COMCTL32.dll
#include <windows.h>
BOOL ImageList_GetIconSize(
HIMAGELIST himl,
INT* cx, // optional
INT* cy // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| himl | HIMAGELIST | in |
| cx | INT* | outoptional |
| cy | INT* | outoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// COMCTL32.dll
#include <windows.h>
BOOL ImageList_GetIconSize(
HIMAGELIST himl,
INT* cx, // optional
INT* cy // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern bool ImageList_GetIconSize(
IntPtr himl, // HIMAGELIST
IntPtr cx, // INT* optional, out
IntPtr cy // INT* optional, out
);<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function ImageList_GetIconSize(
himl As IntPtr, ' HIMAGELIST
cx As IntPtr, ' INT* optional, out
cy As IntPtr ' INT* optional, out
) As Boolean
End Function' himl : HIMAGELIST
' cx : INT* optional, out
' cy : INT* optional, out
Declare PtrSafe Function ImageList_GetIconSize Lib "comctl32" ( _
ByVal himl As LongPtr, _
ByVal cx As LongPtr, _
ByVal cy As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ImageList_GetIconSize = ctypes.windll.comctl32.ImageList_GetIconSize
ImageList_GetIconSize.restype = wintypes.BOOL
ImageList_GetIconSize.argtypes = [
ctypes.c_ssize_t, # himl : HIMAGELIST
ctypes.POINTER(ctypes.c_int), # cx : INT* optional, out
ctypes.POINTER(ctypes.c_int), # cy : INT* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('COMCTL32.dll')
ImageList_GetIconSize = Fiddle::Function.new(
lib['ImageList_GetIconSize'],
[
Fiddle::TYPE_INTPTR_T, # himl : HIMAGELIST
Fiddle::TYPE_VOIDP, # cx : INT* optional, out
Fiddle::TYPE_VOIDP, # cy : INT* optional, out
],
Fiddle::TYPE_INT)#[link(name = "comctl32")]
extern "system" {
fn ImageList_GetIconSize(
himl: isize, // HIMAGELIST
cx: *mut i32, // INT* optional, out
cy: *mut i32 // INT* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll")]
public static extern bool ImageList_GetIconSize(IntPtr himl, IntPtr cx, IntPtr cy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_ImageList_GetIconSize' -Namespace Win32 -PassThru
# $api::ImageList_GetIconSize(himl, cx, cy)#uselib "COMCTL32.dll"
#func global ImageList_GetIconSize "ImageList_GetIconSize" sptr, sptr, sptr
; ImageList_GetIconSize himl, varptr(cx), varptr(cy) ; 戻り値は stat
; himl : HIMAGELIST -> "sptr"
; cx : INT* optional, out -> "sptr"
; cy : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "COMCTL32.dll" #cfunc global ImageList_GetIconSize "ImageList_GetIconSize" sptr, var, var ; res = ImageList_GetIconSize(himl, cx, cy) ; himl : HIMAGELIST -> "sptr" ; cx : INT* optional, out -> "var" ; cy : INT* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "COMCTL32.dll" #cfunc global ImageList_GetIconSize "ImageList_GetIconSize" sptr, sptr, sptr ; res = ImageList_GetIconSize(himl, varptr(cx), varptr(cy)) ; himl : HIMAGELIST -> "sptr" ; cx : INT* optional, out -> "sptr" ; cy : INT* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL ImageList_GetIconSize(HIMAGELIST himl, INT* cx, INT* cy) #uselib "COMCTL32.dll" #cfunc global ImageList_GetIconSize "ImageList_GetIconSize" intptr, var, var ; res = ImageList_GetIconSize(himl, cx, cy) ; himl : HIMAGELIST -> "intptr" ; cx : INT* optional, out -> "var" ; cy : INT* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ImageList_GetIconSize(HIMAGELIST himl, INT* cx, INT* cy) #uselib "COMCTL32.dll" #cfunc global ImageList_GetIconSize "ImageList_GetIconSize" intptr, intptr, intptr ; res = ImageList_GetIconSize(himl, varptr(cx), varptr(cy)) ; himl : HIMAGELIST -> "intptr" ; cx : INT* optional, out -> "intptr" ; cy : INT* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
procImageList_GetIconSize = comctl32.NewProc("ImageList_GetIconSize")
)
// himl (HIMAGELIST), cx (INT* optional, out), cy (INT* optional, out)
r1, _, err := procImageList_GetIconSize.Call(
uintptr(himl),
uintptr(cx),
uintptr(cy),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ImageList_GetIconSize(
himl: NativeInt; // HIMAGELIST
cx: Pointer; // INT* optional, out
cy: Pointer // INT* optional, out
): BOOL; stdcall;
external 'COMCTL32.dll' name 'ImageList_GetIconSize';result := DllCall("COMCTL32\ImageList_GetIconSize"
, "Ptr", himl ; HIMAGELIST
, "Ptr", cx ; INT* optional, out
, "Ptr", cy ; INT* optional, out
, "Int") ; return: BOOL●ImageList_GetIconSize(himl, cx, cy) = DLL("COMCTL32.dll", "bool ImageList_GetIconSize(int, void*, void*)")
# 呼び出し: ImageList_GetIconSize(himl, cx, cy)
# himl : HIMAGELIST -> "int"
# cx : INT* optional, out -> "void*"
# cy : INT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。