SHGetIconOverlayIndexA
関数指定アイコンのオーバーレイインデックスを取得する(ANSI版)。
シグネチャ
// SHELL32.dll (ANSI / -A)
#include <windows.h>
INT SHGetIconOverlayIndexA(
LPCSTR pszIconPath, // optional
INT iIconIndex
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszIconPath | LPCSTR | inoptional |
| iIconIndex | INT | in |
戻り値の型: INT
各言語での呼び出し定義
// SHELL32.dll (ANSI / -A)
#include <windows.h>
INT SHGetIconOverlayIndexA(
LPCSTR pszIconPath, // optional
INT iIconIndex
);[DllImport("SHELL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int SHGetIconOverlayIndexA(
[MarshalAs(UnmanagedType.LPStr)] string pszIconPath, // LPCSTR optional
int iIconIndex // INT
);<DllImport("SHELL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SHGetIconOverlayIndexA(
<MarshalAs(UnmanagedType.LPStr)> pszIconPath As String, ' LPCSTR optional
iIconIndex As Integer ' INT
) As Integer
End Function' pszIconPath : LPCSTR optional
' iIconIndex : INT
Declare PtrSafe Function SHGetIconOverlayIndexA Lib "shell32" ( _
ByVal pszIconPath As String, _
ByVal iIconIndex As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHGetIconOverlayIndexA = ctypes.windll.shell32.SHGetIconOverlayIndexA
SHGetIconOverlayIndexA.restype = ctypes.c_int
SHGetIconOverlayIndexA.argtypes = [
wintypes.LPCSTR, # pszIconPath : LPCSTR optional
ctypes.c_int, # iIconIndex : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHGetIconOverlayIndexA = Fiddle::Function.new(
lib['SHGetIconOverlayIndexA'],
[
Fiddle::TYPE_VOIDP, # pszIconPath : LPCSTR optional
Fiddle::TYPE_INT, # iIconIndex : INT
],
Fiddle::TYPE_INT)#[link(name = "shell32")]
extern "system" {
fn SHGetIconOverlayIndexA(
pszIconPath: *const u8, // LPCSTR optional
iIconIndex: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll", CharSet = CharSet.Ansi)]
public static extern int SHGetIconOverlayIndexA([MarshalAs(UnmanagedType.LPStr)] string pszIconPath, int iIconIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHGetIconOverlayIndexA' -Namespace Win32 -PassThru
# $api::SHGetIconOverlayIndexA(pszIconPath, iIconIndex)#uselib "SHELL32.dll"
#func global SHGetIconOverlayIndexA "SHGetIconOverlayIndexA" sptr, sptr
; SHGetIconOverlayIndexA pszIconPath, iIconIndex ; 戻り値は stat
; pszIconPath : LPCSTR optional -> "sptr"
; iIconIndex : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global SHGetIconOverlayIndexA "SHGetIconOverlayIndexA" str, int
; res = SHGetIconOverlayIndexA(pszIconPath, iIconIndex)
; pszIconPath : LPCSTR optional -> "str"
; iIconIndex : INT -> "int"; INT SHGetIconOverlayIndexA(LPCSTR pszIconPath, INT iIconIndex)
#uselib "SHELL32.dll"
#cfunc global SHGetIconOverlayIndexA "SHGetIconOverlayIndexA" str, int
; res = SHGetIconOverlayIndexA(pszIconPath, iIconIndex)
; pszIconPath : LPCSTR optional -> "str"
; iIconIndex : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHGetIconOverlayIndexA = shell32.NewProc("SHGetIconOverlayIndexA")
)
// pszIconPath (LPCSTR optional), iIconIndex (INT)
r1, _, err := procSHGetIconOverlayIndexA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszIconPath))),
uintptr(iIconIndex),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction SHGetIconOverlayIndexA(
pszIconPath: PAnsiChar; // LPCSTR optional
iIconIndex: Integer // INT
): Integer; stdcall;
external 'SHELL32.dll' name 'SHGetIconOverlayIndexA';result := DllCall("SHELL32\SHGetIconOverlayIndexA"
, "AStr", pszIconPath ; LPCSTR optional
, "Int", iIconIndex ; INT
, "Int") ; return: INT●SHGetIconOverlayIndexA(pszIconPath, iIconIndex) = DLL("SHELL32.dll", "int SHGetIconOverlayIndexA(char*, int)")
# 呼び出し: SHGetIconOverlayIndexA(pszIconPath, iIconIndex)
# pszIconPath : LPCSTR optional -> "char*"
# iIconIndex : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。