ホーム › UI.Shell.PropertiesSystem › PSPropertyBag_Delete
PSPropertyBag_Delete
関数プロパティバッグから指定プロパティを削除する。
シグネチャ
// PROPSYS.dll
#include <windows.h>
HRESULT PSPropertyBag_Delete(
IPropertyBag* propBag,
LPCWSTR propName
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| propBag | IPropertyBag* | in | 対象のプロパティバッグを表すIPropertyBagインターフェイス。 |
| propName | LPCWSTR | in | 削除するプロパティの名前を指すワイド文字列。バッグ内のキー。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// PROPSYS.dll
#include <windows.h>
HRESULT PSPropertyBag_Delete(
IPropertyBag* propBag,
LPCWSTR propName
);[DllImport("PROPSYS.dll", ExactSpelling = true)]
static extern int PSPropertyBag_Delete(
IntPtr propBag, // IPropertyBag*
[MarshalAs(UnmanagedType.LPWStr)] string propName // LPCWSTR
);<DllImport("PROPSYS.dll", ExactSpelling:=True)>
Public Shared Function PSPropertyBag_Delete(
propBag As IntPtr, ' IPropertyBag*
<MarshalAs(UnmanagedType.LPWStr)> propName As String ' LPCWSTR
) As Integer
End Function' propBag : IPropertyBag*
' propName : LPCWSTR
Declare PtrSafe Function PSPropertyBag_Delete Lib "propsys" ( _
ByVal propBag As LongPtr, _
ByVal propName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PSPropertyBag_Delete = ctypes.windll.propsys.PSPropertyBag_Delete
PSPropertyBag_Delete.restype = ctypes.c_int
PSPropertyBag_Delete.argtypes = [
ctypes.c_void_p, # propBag : IPropertyBag*
wintypes.LPCWSTR, # propName : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('PROPSYS.dll')
PSPropertyBag_Delete = Fiddle::Function.new(
lib['PSPropertyBag_Delete'],
[
Fiddle::TYPE_VOIDP, # propBag : IPropertyBag*
Fiddle::TYPE_VOIDP, # propName : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "propsys")]
extern "system" {
fn PSPropertyBag_Delete(
propBag: *mut core::ffi::c_void, // IPropertyBag*
propName: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("PROPSYS.dll")]
public static extern int PSPropertyBag_Delete(IntPtr propBag, [MarshalAs(UnmanagedType.LPWStr)] string propName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PROPSYS_PSPropertyBag_Delete' -Namespace Win32 -PassThru
# $api::PSPropertyBag_Delete(propBag, propName)#uselib "PROPSYS.dll"
#func global PSPropertyBag_Delete "PSPropertyBag_Delete" sptr, sptr
; PSPropertyBag_Delete propBag, propName ; 戻り値は stat
; propBag : IPropertyBag* -> "sptr"
; propName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "PROPSYS.dll"
#cfunc global PSPropertyBag_Delete "PSPropertyBag_Delete" sptr, wstr
; res = PSPropertyBag_Delete(propBag, propName)
; propBag : IPropertyBag* -> "sptr"
; propName : LPCWSTR -> "wstr"; HRESULT PSPropertyBag_Delete(IPropertyBag* propBag, LPCWSTR propName)
#uselib "PROPSYS.dll"
#cfunc global PSPropertyBag_Delete "PSPropertyBag_Delete" intptr, wstr
; res = PSPropertyBag_Delete(propBag, propName)
; propBag : IPropertyBag* -> "intptr"
; propName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
propsys = windows.NewLazySystemDLL("PROPSYS.dll")
procPSPropertyBag_Delete = propsys.NewProc("PSPropertyBag_Delete")
)
// propBag (IPropertyBag*), propName (LPCWSTR)
r1, _, err := procPSPropertyBag_Delete.Call(
uintptr(propBag),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(propName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PSPropertyBag_Delete(
propBag: Pointer; // IPropertyBag*
propName: PWideChar // LPCWSTR
): Integer; stdcall;
external 'PROPSYS.dll' name 'PSPropertyBag_Delete';result := DllCall("PROPSYS\PSPropertyBag_Delete"
, "Ptr", propBag ; IPropertyBag*
, "WStr", propName ; LPCWSTR
, "Int") ; return: HRESULT●PSPropertyBag_Delete(propBag, propName) = DLL("PROPSYS.dll", "int PSPropertyBag_Delete(void*, char*)")
# 呼び出し: PSPropertyBag_Delete(propBag, propName)
# propBag : IPropertyBag* -> "void*"
# propName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "propsys" fn PSPropertyBag_Delete(
propBag: ?*anyopaque, // IPropertyBag*
propName: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;proc PSPropertyBag_Delete(
propBag: pointer, # IPropertyBag*
propName: WideCString # LPCWSTR
): int32 {.importc: "PSPropertyBag_Delete", stdcall, dynlib: "PROPSYS.dll".}pragma(lib, "propsys");
extern(Windows)
int PSPropertyBag_Delete(
void* propBag, // IPropertyBag*
const(wchar)* propName // LPCWSTR
);ccall((:PSPropertyBag_Delete, "PROPSYS.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring),
propBag, propName)
# propBag : IPropertyBag* -> Ptr{Cvoid}
# propName : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t PSPropertyBag_Delete(
void* propBag,
const uint16_t* propName);
]]
local propsys = ffi.load("propsys")
-- propsys.PSPropertyBag_Delete(propBag, propName)
-- propBag : IPropertyBag*
-- propName : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('PROPSYS.dll');
const PSPropertyBag_Delete = lib.func('__stdcall', 'PSPropertyBag_Delete', 'int32_t', ['void *', 'str16']);
// PSPropertyBag_Delete(propBag, propName)
// propBag : IPropertyBag* -> 'void *'
// propName : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("PROPSYS.dll", {
PSPropertyBag_Delete: { parameters: ["pointer", "buffer"], result: "i32" },
});
// lib.symbols.PSPropertyBag_Delete(propBag, propName)
// propBag : IPropertyBag* -> "pointer"
// propName : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t PSPropertyBag_Delete(
void* propBag,
const uint16_t* propName);
C, "PROPSYS.dll");
// $ffi->PSPropertyBag_Delete(propBag, propName);
// propBag : IPropertyBag*
// propName : LPCWSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Propsys extends StdCallLibrary {
Propsys INSTANCE = Native.load("propsys", Propsys.class);
int PSPropertyBag_Delete(
Pointer propBag, // IPropertyBag*
WString propName // LPCWSTR
);
}@[Link("propsys")]
lib LibPROPSYS
fun PSPropertyBag_Delete = PSPropertyBag_Delete(
propBag : Void*, # IPropertyBag*
propName : UInt16* # LPCWSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef PSPropertyBag_DeleteNative = Int32 Function(Pointer<Void>, Pointer<Utf16>);
typedef PSPropertyBag_DeleteDart = int Function(Pointer<Void>, Pointer<Utf16>);
final PSPropertyBag_Delete = DynamicLibrary.open('PROPSYS.dll')
.lookupFunction<PSPropertyBag_DeleteNative, PSPropertyBag_DeleteDart>('PSPropertyBag_Delete');
// propBag : IPropertyBag* -> Pointer<Void>
// propName : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function PSPropertyBag_Delete(
propBag: Pointer; // IPropertyBag*
propName: PWideChar // LPCWSTR
): Integer; stdcall;
external 'PROPSYS.dll' name 'PSPropertyBag_Delete';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "PSPropertyBag_Delete"
c_PSPropertyBag_Delete :: Ptr () -> CWString -> IO Int32
-- propBag : IPropertyBag* -> Ptr ()
-- propName : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let pspropertybag_delete =
foreign "PSPropertyBag_Delete"
((ptr void) @-> (ptr uint16_t) @-> returning int32_t)
(* propBag : IPropertyBag* -> (ptr void) *)
(* propName : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library propsys (t "PROPSYS.dll"))
(cffi:use-foreign-library propsys)
(cffi:defcfun ("PSPropertyBag_Delete" psproperty-bag-delete :convention :stdcall) :int32
(prop-bag :pointer) ; IPropertyBag*
(prop-name (:string :encoding :utf-16le))) ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $PSPropertyBag_Delete = Win32::API::More->new('PROPSYS',
'int PSPropertyBag_Delete(LPVOID propBag, LPCWSTR propName)');
# my $ret = $PSPropertyBag_Delete->Call($propBag, $propName);
# propBag : IPropertyBag* -> LPVOID
# propName : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型