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