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