Shell_GetImageLists
関数システムの大小アイコンイメージリストを取得する。
シグネチャ
// SHELL32.dll
#include <windows.h>
BOOL Shell_GetImageLists(
HIMAGELIST* phiml, // optional
HIMAGELIST* phimlSmall // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| phiml | HIMAGELIST* | outoptional | イメージリストのハンドルへのポインターです。成功時には、大きい (32 x 32) アイコン用のシステムイメージリストを受け取ります。 |
| phimlSmall | HIMAGELIST* | outoptional | イメージリストのハンドルへのポインターです。成功時には、小さい (16 x 16) アイコン用のシステムイメージリストを受け取ります。 |
戻り値の型: BOOL
公式ドキュメント
大きいアイコンと小さいアイコン用のシステムイメージリストを取得します。
戻り値
型: BOOL
成功した場合は TRUE を返します。失敗した場合は FALSE を返し、phiml および phimlSmall が指すイメージリストは変更されません。
解説(Remarks)
重要 この関数を通じて取得されるイメージリストはグローバルなシステムイメージリストです。これらに対して ImageList_Destroy を呼び出さないでください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
BOOL Shell_GetImageLists(
HIMAGELIST* phiml, // optional
HIMAGELIST* phimlSmall // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern bool Shell_GetImageLists(
IntPtr phiml, // HIMAGELIST* optional, out
IntPtr phimlSmall // HIMAGELIST* optional, out
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function Shell_GetImageLists(
phiml As IntPtr, ' HIMAGELIST* optional, out
phimlSmall As IntPtr ' HIMAGELIST* optional, out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' phiml : HIMAGELIST* optional, out
' phimlSmall : HIMAGELIST* optional, out
Declare PtrSafe Function Shell_GetImageLists Lib "shell32" ( _
ByVal phiml As LongPtr, _
ByVal phimlSmall As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
Shell_GetImageLists = ctypes.windll.shell32.Shell_GetImageLists
Shell_GetImageLists.restype = wintypes.BOOL
Shell_GetImageLists.argtypes = [
ctypes.c_void_p, # phiml : HIMAGELIST* optional, out
ctypes.c_void_p, # phimlSmall : HIMAGELIST* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
Shell_GetImageLists = Fiddle::Function.new(
lib['Shell_GetImageLists'],
[
Fiddle::TYPE_VOIDP, # phiml : HIMAGELIST* optional, out
Fiddle::TYPE_VOIDP, # phimlSmall : HIMAGELIST* optional, out
],
Fiddle::TYPE_INT)#[link(name = "shell32")]
extern "system" {
fn Shell_GetImageLists(
phiml: *mut isize, // HIMAGELIST* optional, out
phimlSmall: *mut isize // HIMAGELIST* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll")]
public static extern bool Shell_GetImageLists(IntPtr phiml, IntPtr phimlSmall);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_Shell_GetImageLists' -Namespace Win32 -PassThru
# $api::Shell_GetImageLists(phiml, phimlSmall)#uselib "SHELL32.dll"
#func global Shell_GetImageLists "Shell_GetImageLists" sptr, sptr
; Shell_GetImageLists varptr(phiml), varptr(phimlSmall) ; 戻り値は stat
; phiml : HIMAGELIST* optional, out -> "sptr"
; phimlSmall : HIMAGELIST* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SHELL32.dll" #cfunc global Shell_GetImageLists "Shell_GetImageLists" var, var ; res = Shell_GetImageLists(phiml, phimlSmall) ; phiml : HIMAGELIST* optional, out -> "var" ; phimlSmall : HIMAGELIST* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHELL32.dll" #cfunc global Shell_GetImageLists "Shell_GetImageLists" sptr, sptr ; res = Shell_GetImageLists(varptr(phiml), varptr(phimlSmall)) ; phiml : HIMAGELIST* optional, out -> "sptr" ; phimlSmall : HIMAGELIST* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL Shell_GetImageLists(HIMAGELIST* phiml, HIMAGELIST* phimlSmall) #uselib "SHELL32.dll" #cfunc global Shell_GetImageLists "Shell_GetImageLists" var, var ; res = Shell_GetImageLists(phiml, phimlSmall) ; phiml : HIMAGELIST* optional, out -> "var" ; phimlSmall : HIMAGELIST* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL Shell_GetImageLists(HIMAGELIST* phiml, HIMAGELIST* phimlSmall) #uselib "SHELL32.dll" #cfunc global Shell_GetImageLists "Shell_GetImageLists" intptr, intptr ; res = Shell_GetImageLists(varptr(phiml), varptr(phimlSmall)) ; phiml : HIMAGELIST* optional, out -> "intptr" ; phimlSmall : HIMAGELIST* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procShell_GetImageLists = shell32.NewProc("Shell_GetImageLists")
)
// phiml (HIMAGELIST* optional, out), phimlSmall (HIMAGELIST* optional, out)
r1, _, err := procShell_GetImageLists.Call(
uintptr(phiml),
uintptr(phimlSmall),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction Shell_GetImageLists(
phiml: Pointer; // HIMAGELIST* optional, out
phimlSmall: Pointer // HIMAGELIST* optional, out
): BOOL; stdcall;
external 'SHELL32.dll' name 'Shell_GetImageLists';result := DllCall("SHELL32\Shell_GetImageLists"
, "Ptr", phiml ; HIMAGELIST* optional, out
, "Ptr", phimlSmall ; HIMAGELIST* optional, out
, "Int") ; return: BOOL●Shell_GetImageLists(phiml, phimlSmall) = DLL("SHELL32.dll", "bool Shell_GetImageLists(void*, void*)")
# 呼び出し: Shell_GetImageLists(phiml, phimlSmall)
# phiml : HIMAGELIST* optional, out -> "void*"
# phimlSmall : HIMAGELIST* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "shell32" fn Shell_GetImageLists(
phiml: [*c]isize, // HIMAGELIST* optional, out
phimlSmall: [*c]isize // HIMAGELIST* optional, out
) callconv(std.os.windows.WINAPI) i32;proc Shell_GetImageLists(
phiml: ptr int, # HIMAGELIST* optional, out
phimlSmall: ptr int # HIMAGELIST* optional, out
): int32 {.importc: "Shell_GetImageLists", stdcall, dynlib: "SHELL32.dll".}pragma(lib, "shell32");
extern(Windows)
int Shell_GetImageLists(
ptrdiff_t* phiml, // HIMAGELIST* optional, out
ptrdiff_t* phimlSmall // HIMAGELIST* optional, out
);ccall((:Shell_GetImageLists, "SHELL32.dll"), stdcall, Int32,
(Ptr{Int}, Ptr{Int}),
phiml, phimlSmall)
# phiml : HIMAGELIST* optional, out -> Ptr{Int}
# phimlSmall : HIMAGELIST* optional, out -> Ptr{Int}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t Shell_GetImageLists(
intptr_t* phiml,
intptr_t* phimlSmall);
]]
local shell32 = ffi.load("shell32")
-- shell32.Shell_GetImageLists(phiml, phimlSmall)
-- phiml : HIMAGELIST* optional, out
-- phimlSmall : HIMAGELIST* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SHELL32.dll');
const Shell_GetImageLists = lib.func('__stdcall', 'Shell_GetImageLists', 'int32_t', ['intptr_t *', 'intptr_t *']);
// Shell_GetImageLists(phiml, phimlSmall)
// phiml : HIMAGELIST* optional, out -> 'intptr_t *'
// phimlSmall : HIMAGELIST* optional, out -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SHELL32.dll", {
Shell_GetImageLists: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.Shell_GetImageLists(phiml, phimlSmall)
// phiml : HIMAGELIST* optional, out -> "pointer"
// phimlSmall : HIMAGELIST* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t Shell_GetImageLists(
intptr_t* phiml,
intptr_t* phimlSmall);
C, "SHELL32.dll");
// $ffi->Shell_GetImageLists(phiml, phimlSmall);
// phiml : HIMAGELIST* optional, out
// phimlSmall : HIMAGELIST* optional, 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 Shell32 extends StdCallLibrary {
Shell32 INSTANCE = Native.load("shell32", Shell32.class);
boolean Shell_GetImageLists(
LongByReference phiml, // HIMAGELIST* optional, out
LongByReference phimlSmall // HIMAGELIST* optional, out
);
}@[Link("shell32")]
lib LibSHELL32
fun Shell_GetImageLists = Shell_GetImageLists(
phiml : LibC::SSizeT*, # HIMAGELIST* optional, out
phimlSmall : LibC::SSizeT* # HIMAGELIST* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef Shell_GetImageListsNative = Int32 Function(Pointer<IntPtr>, Pointer<IntPtr>);
typedef Shell_GetImageListsDart = int Function(Pointer<IntPtr>, Pointer<IntPtr>);
final Shell_GetImageLists = DynamicLibrary.open('SHELL32.dll')
.lookupFunction<Shell_GetImageListsNative, Shell_GetImageListsDart>('Shell_GetImageLists');
// phiml : HIMAGELIST* optional, out -> Pointer<IntPtr>
// phimlSmall : HIMAGELIST* optional, out -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function Shell_GetImageLists(
phiml: Pointer; // HIMAGELIST* optional, out
phimlSmall: Pointer // HIMAGELIST* optional, out
): BOOL; stdcall;
external 'SHELL32.dll' name 'Shell_GetImageLists';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "Shell_GetImageLists"
c_Shell_GetImageLists :: Ptr CIntPtr -> Ptr CIntPtr -> IO CInt
-- phiml : HIMAGELIST* optional, out -> Ptr CIntPtr
-- phimlSmall : HIMAGELIST* optional, out -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let shell_getimagelists =
foreign "Shell_GetImageLists"
((ptr intptr_t) @-> (ptr intptr_t) @-> returning int32_t)
(* phiml : HIMAGELIST* optional, out -> (ptr intptr_t) *)
(* phimlSmall : HIMAGELIST* optional, out -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library shell32 (t "SHELL32.dll"))
(cffi:use-foreign-library shell32)
(cffi:defcfun ("Shell_GetImageLists" shell-get-image-lists :convention :stdcall) :int32
(phiml :pointer) ; HIMAGELIST* optional, out
(phiml-small :pointer)) ; HIMAGELIST* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $Shell_GetImageLists = Win32::API::More->new('SHELL32',
'BOOL Shell_GetImageLists(LPVOID phiml, LPVOID phimlSmall)');
# my $ret = $Shell_GetImageLists->Call($phiml, $phimlSmall);
# phiml : HIMAGELIST* optional, out -> LPVOID
# phimlSmall : HIMAGELIST* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f SHGetFileInfoW — ファイルのアイコンや種類名などの情報を取得する。
- f SHGetImageList — システムイメージリストのインターフェイスを取得する。