Win32 API 日本語リファレンス
ホームUI.Shell.PropertiesSystem › PifMgr_SetProperties

PifMgr_SetProperties

関数
PIFハンドルに指定グループのプロパティを設定する。
DLLSHELL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHELL32.dll
#include <windows.h>

INT PifMgr_SetProperties(
    HANDLE hProps,   // optional
    LPCSTR pszGroup,   // optional
    const void* lpProps,
    INT cbProps,
    DWORD flOpt
);

パラメーター

名前方向
hPropsHANDLEinoptional
pszGroupLPCSTRinoptional
lpPropsvoid*in
cbPropsINTin
flOptDWORDin

戻り値の型: INT

各言語での呼び出し定義

// SHELL32.dll
#include <windows.h>

INT PifMgr_SetProperties(
    HANDLE hProps,   // optional
    LPCSTR pszGroup,   // optional
    const void* lpProps,
    INT cbProps,
    DWORD flOpt
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int PifMgr_SetProperties(
    IntPtr hProps,   // HANDLE optional
    [MarshalAs(UnmanagedType.LPStr)] string pszGroup,   // LPCSTR optional
    IntPtr lpProps,   // void*
    int cbProps,   // INT
    uint flOpt   // DWORD
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function PifMgr_SetProperties(
    hProps As IntPtr,   ' HANDLE optional
    <MarshalAs(UnmanagedType.LPStr)> pszGroup As String,   ' LPCSTR optional
    lpProps As IntPtr,   ' void*
    cbProps As Integer,   ' INT
    flOpt As UInteger   ' DWORD
) As Integer
End Function
' hProps : HANDLE optional
' pszGroup : LPCSTR optional
' lpProps : void*
' cbProps : INT
' flOpt : DWORD
Declare PtrSafe Function PifMgr_SetProperties Lib "shell32" ( _
    ByVal hProps As LongPtr, _
    ByVal pszGroup As String, _
    ByVal lpProps As LongPtr, _
    ByVal cbProps As Long, _
    ByVal flOpt As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PifMgr_SetProperties = ctypes.windll.shell32.PifMgr_SetProperties
PifMgr_SetProperties.restype = ctypes.c_int
PifMgr_SetProperties.argtypes = [
    wintypes.HANDLE,  # hProps : HANDLE optional
    wintypes.LPCSTR,  # pszGroup : LPCSTR optional
    ctypes.POINTER(None),  # lpProps : void*
    ctypes.c_int,  # cbProps : INT
    wintypes.DWORD,  # flOpt : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
PifMgr_SetProperties = Fiddle::Function.new(
  lib['PifMgr_SetProperties'],
  [
    Fiddle::TYPE_VOIDP,  # hProps : HANDLE optional
    Fiddle::TYPE_VOIDP,  # pszGroup : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # lpProps : void*
    Fiddle::TYPE_INT,  # cbProps : INT
    -Fiddle::TYPE_INT,  # flOpt : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "shell32")]
extern "system" {
    fn PifMgr_SetProperties(
        hProps: *mut core::ffi::c_void,  // HANDLE optional
        pszGroup: *const u8,  // LPCSTR optional
        lpProps: *const (),  // void*
        cbProps: i32,  // INT
        flOpt: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHELL32.dll")]
public static extern int PifMgr_SetProperties(IntPtr hProps, [MarshalAs(UnmanagedType.LPStr)] string pszGroup, IntPtr lpProps, int cbProps, uint flOpt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_PifMgr_SetProperties' -Namespace Win32 -PassThru
# $api::PifMgr_SetProperties(hProps, pszGroup, lpProps, cbProps, flOpt)
#uselib "SHELL32.dll"
#func global PifMgr_SetProperties "PifMgr_SetProperties" sptr, sptr, sptr, sptr, sptr
; PifMgr_SetProperties hProps, pszGroup, lpProps, cbProps, flOpt   ; 戻り値は stat
; hProps : HANDLE optional -> "sptr"
; pszGroup : LPCSTR optional -> "sptr"
; lpProps : void* -> "sptr"
; cbProps : INT -> "sptr"
; flOpt : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHELL32.dll"
#cfunc global PifMgr_SetProperties "PifMgr_SetProperties" sptr, str, sptr, int, int
; res = PifMgr_SetProperties(hProps, pszGroup, lpProps, cbProps, flOpt)
; hProps : HANDLE optional -> "sptr"
; pszGroup : LPCSTR optional -> "str"
; lpProps : void* -> "sptr"
; cbProps : INT -> "int"
; flOpt : DWORD -> "int"
; INT PifMgr_SetProperties(HANDLE hProps, LPCSTR pszGroup, void* lpProps, INT cbProps, DWORD flOpt)
#uselib "SHELL32.dll"
#cfunc global PifMgr_SetProperties "PifMgr_SetProperties" intptr, str, intptr, int, int
; res = PifMgr_SetProperties(hProps, pszGroup, lpProps, cbProps, flOpt)
; hProps : HANDLE optional -> "intptr"
; pszGroup : LPCSTR optional -> "str"
; lpProps : void* -> "intptr"
; cbProps : INT -> "int"
; flOpt : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procPifMgr_SetProperties = shell32.NewProc("PifMgr_SetProperties")
)

// hProps (HANDLE optional), pszGroup (LPCSTR optional), lpProps (void*), cbProps (INT), flOpt (DWORD)
r1, _, err := procPifMgr_SetProperties.Call(
	uintptr(hProps),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszGroup))),
	uintptr(lpProps),
	uintptr(cbProps),
	uintptr(flOpt),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function PifMgr_SetProperties(
  hProps: THandle;   // HANDLE optional
  pszGroup: PAnsiChar;   // LPCSTR optional
  lpProps: Pointer;   // void*
  cbProps: Integer;   // INT
  flOpt: DWORD   // DWORD
): Integer; stdcall;
  external 'SHELL32.dll' name 'PifMgr_SetProperties';
result := DllCall("SHELL32\PifMgr_SetProperties"
    , "Ptr", hProps   ; HANDLE optional
    , "AStr", pszGroup   ; LPCSTR optional
    , "Ptr", lpProps   ; void*
    , "Int", cbProps   ; INT
    , "UInt", flOpt   ; DWORD
    , "Int")   ; return: INT
●PifMgr_SetProperties(hProps, pszGroup, lpProps, cbProps, flOpt) = DLL("SHELL32.dll", "int PifMgr_SetProperties(void*, char*, void*, int, dword)")
# 呼び出し: PifMgr_SetProperties(hProps, pszGroup, lpProps, cbProps, flOpt)
# hProps : HANDLE optional -> "void*"
# pszGroup : LPCSTR optional -> "char*"
# lpProps : void* -> "void*"
# cbProps : INT -> "int"
# flOpt : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。