Win32 API 日本語リファレンス
ホームUI.Controls › ImageList_SetIconSize

ImageList_SetIconSize

関数
イメージリストの画像サイズを設定し内容を消去する。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOL ImageList_SetIconSize(
    HIMAGELIST himl,
    INT cx,
    INT cy
);

パラメーター

名前方向
himlHIMAGELISTin
cxINTin
cyINTin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL ImageList_SetIconSize(
    HIMAGELIST himl,
    INT cx,
    INT cy
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern bool ImageList_SetIconSize(
    IntPtr himl,   // HIMAGELIST
    int cx,   // INT
    int cy   // INT
);
<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function ImageList_SetIconSize(
    himl As IntPtr,   ' HIMAGELIST
    cx As Integer,   ' INT
    cy As Integer   ' INT
) As Boolean
End Function
' himl : HIMAGELIST
' cx : INT
' cy : INT
Declare PtrSafe Function ImageList_SetIconSize Lib "comctl32" ( _
    ByVal himl As LongPtr, _
    ByVal cx As Long, _
    ByVal cy As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ImageList_SetIconSize = ctypes.windll.comctl32.ImageList_SetIconSize
ImageList_SetIconSize.restype = wintypes.BOOL
ImageList_SetIconSize.argtypes = [
    ctypes.c_ssize_t,  # himl : HIMAGELIST
    ctypes.c_int,  # cx : INT
    ctypes.c_int,  # cy : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMCTL32.dll')
ImageList_SetIconSize = Fiddle::Function.new(
  lib['ImageList_SetIconSize'],
  [
    Fiddle::TYPE_INTPTR_T,  # himl : HIMAGELIST
    Fiddle::TYPE_INT,  # cx : INT
    Fiddle::TYPE_INT,  # cy : INT
  ],
  Fiddle::TYPE_INT)
#[link(name = "comctl32")]
extern "system" {
    fn ImageList_SetIconSize(
        himl: isize,  // HIMAGELIST
        cx: i32,  // INT
        cy: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll")]
public static extern bool ImageList_SetIconSize(IntPtr himl, int cx, int cy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_ImageList_SetIconSize' -Namespace Win32 -PassThru
# $api::ImageList_SetIconSize(himl, cx, cy)
#uselib "COMCTL32.dll"
#func global ImageList_SetIconSize "ImageList_SetIconSize" sptr, sptr, sptr
; ImageList_SetIconSize himl, cx, cy   ; 戻り値は stat
; himl : HIMAGELIST -> "sptr"
; cx : INT -> "sptr"
; cy : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "COMCTL32.dll"
#cfunc global ImageList_SetIconSize "ImageList_SetIconSize" sptr, int, int
; res = ImageList_SetIconSize(himl, cx, cy)
; himl : HIMAGELIST -> "sptr"
; cx : INT -> "int"
; cy : INT -> "int"
; BOOL ImageList_SetIconSize(HIMAGELIST himl, INT cx, INT cy)
#uselib "COMCTL32.dll"
#cfunc global ImageList_SetIconSize "ImageList_SetIconSize" intptr, int, int
; res = ImageList_SetIconSize(himl, cx, cy)
; himl : HIMAGELIST -> "intptr"
; cx : INT -> "int"
; cy : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procImageList_SetIconSize = comctl32.NewProc("ImageList_SetIconSize")
)

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