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

ILIsEqual

関数
二つのアイテムIDリストが等しいか比較する。
DLLSHELL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL ILIsEqual(
    ITEMIDLIST* pidl1,
    ITEMIDLIST* pidl2
);

パラメーター

名前方向
pidl1ITEMIDLIST*in
pidl2ITEMIDLIST*in

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL ILIsEqual(
    ITEMIDLIST* pidl1,
    ITEMIDLIST* pidl2
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern bool ILIsEqual(
    IntPtr pidl1,   // ITEMIDLIST*
    IntPtr pidl2   // ITEMIDLIST*
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function ILIsEqual(
    pidl1 As IntPtr,   ' ITEMIDLIST*
    pidl2 As IntPtr   ' ITEMIDLIST*
) As Boolean
End Function
' pidl1 : ITEMIDLIST*
' pidl2 : ITEMIDLIST*
Declare PtrSafe Function ILIsEqual Lib "shell32" ( _
    ByVal pidl1 As LongPtr, _
    ByVal pidl2 As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ILIsEqual = ctypes.windll.shell32.ILIsEqual
ILIsEqual.restype = wintypes.BOOL
ILIsEqual.argtypes = [
    ctypes.c_void_p,  # pidl1 : ITEMIDLIST*
    ctypes.c_void_p,  # pidl2 : ITEMIDLIST*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
ILIsEqual = Fiddle::Function.new(
  lib['ILIsEqual'],
  [
    Fiddle::TYPE_VOIDP,  # pidl1 : ITEMIDLIST*
    Fiddle::TYPE_VOIDP,  # pidl2 : ITEMIDLIST*
  ],
  Fiddle::TYPE_INT)
#[link(name = "shell32")]
extern "system" {
    fn ILIsEqual(
        pidl1: *mut ITEMIDLIST,  // ITEMIDLIST*
        pidl2: *mut ITEMIDLIST  // ITEMIDLIST*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll")]
public static extern bool ILIsEqual(IntPtr pidl1, IntPtr pidl2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_ILIsEqual' -Namespace Win32 -PassThru
# $api::ILIsEqual(pidl1, pidl2)
#uselib "SHELL32.dll"
#func global ILIsEqual "ILIsEqual" sptr, sptr
; ILIsEqual varptr(pidl1), varptr(pidl2)   ; 戻り値は stat
; pidl1 : ITEMIDLIST* -> "sptr"
; pidl2 : ITEMIDLIST* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SHELL32.dll"
#cfunc global ILIsEqual "ILIsEqual" var, var
; res = ILIsEqual(pidl1, pidl2)
; pidl1 : ITEMIDLIST* -> "var"
; pidl2 : ITEMIDLIST* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL ILIsEqual(ITEMIDLIST* pidl1, ITEMIDLIST* pidl2)
#uselib "SHELL32.dll"
#cfunc global ILIsEqual "ILIsEqual" var, var
; res = ILIsEqual(pidl1, pidl2)
; pidl1 : ITEMIDLIST* -> "var"
; pidl2 : ITEMIDLIST* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procILIsEqual = shell32.NewProc("ILIsEqual")
)

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