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