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