SHSimpleIDListFromPath
関数ファイルパスから単純なアイテムIDリストを生成する。
シグネチャ
// SHELL32.dll
#include <windows.h>
ITEMIDLIST* SHSimpleIDListFromPath(
LPCWSTR pszPath
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPath | LPCWSTR | in |
戻り値の型: ITEMIDLIST*
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
ITEMIDLIST* SHSimpleIDListFromPath(
LPCWSTR pszPath
);[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern IntPtr SHSimpleIDListFromPath(
[MarshalAs(UnmanagedType.LPWStr)] string pszPath // LPCWSTR
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function SHSimpleIDListFromPath(
<MarshalAs(UnmanagedType.LPWStr)> pszPath As String ' LPCWSTR
) As IntPtr
End Function' pszPath : LPCWSTR
Declare PtrSafe Function SHSimpleIDListFromPath Lib "shell32" ( _
ByVal pszPath As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHSimpleIDListFromPath = ctypes.windll.shell32.SHSimpleIDListFromPath
SHSimpleIDListFromPath.restype = ctypes.c_void_p
SHSimpleIDListFromPath.argtypes = [
wintypes.LPCWSTR, # pszPath : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHSimpleIDListFromPath = Fiddle::Function.new(
lib['SHSimpleIDListFromPath'],
[
Fiddle::TYPE_VOIDP, # pszPath : LPCWSTR
],
Fiddle::TYPE_VOIDP)#[link(name = "shell32")]
extern "system" {
fn SHSimpleIDListFromPath(
pszPath: *const u16 // LPCWSTR
) -> *mut ITEMIDLIST;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll")]
public static extern IntPtr SHSimpleIDListFromPath([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHSimpleIDListFromPath' -Namespace Win32 -PassThru
# $api::SHSimpleIDListFromPath(pszPath)#uselib "SHELL32.dll"
#func global SHSimpleIDListFromPath "SHSimpleIDListFromPath" sptr
; SHSimpleIDListFromPath pszPath ; 戻り値は stat
; pszPath : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global SHSimpleIDListFromPath "SHSimpleIDListFromPath" wstr
; res = SHSimpleIDListFromPath(pszPath)
; pszPath : LPCWSTR -> "wstr"; ITEMIDLIST* SHSimpleIDListFromPath(LPCWSTR pszPath)
#uselib "SHELL32.dll"
#cfunc global SHSimpleIDListFromPath "SHSimpleIDListFromPath" wstr
; res = SHSimpleIDListFromPath(pszPath)
; pszPath : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHSimpleIDListFromPath = shell32.NewProc("SHSimpleIDListFromPath")
)
// pszPath (LPCWSTR)
r1, _, err := procSHSimpleIDListFromPath.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPath))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // ITEMIDLIST*function SHSimpleIDListFromPath(
pszPath: PWideChar // LPCWSTR
): Pointer; stdcall;
external 'SHELL32.dll' name 'SHSimpleIDListFromPath';result := DllCall("SHELL32\SHSimpleIDListFromPath"
, "WStr", pszPath ; LPCWSTR
, "Ptr") ; return: ITEMIDLIST*●SHSimpleIDListFromPath(pszPath) = DLL("SHELL32.dll", "void* SHSimpleIDListFromPath(char*)")
# 呼び出し: SHSimpleIDListFromPath(pszPath)
# pszPath : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。