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