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

PifMgr_OpenProperties

関数
PIFファイルのプロパティを開いてハンドルを返す。
DLLSHELL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HANDLE PifMgr_OpenProperties(
    LPCWSTR pszApp,
    LPCWSTR pszPIF,   // optional
    DWORD hInf,
    DWORD flOpt
);

パラメーター

名前方向
pszAppLPCWSTRin
pszPIFLPCWSTRinoptional
hInfDWORDin
flOptDWORDin

戻り値の型: HANDLE

各言語での呼び出し定義

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

HANDLE PifMgr_OpenProperties(
    LPCWSTR pszApp,
    LPCWSTR pszPIF,   // optional
    DWORD hInf,
    DWORD flOpt
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern IntPtr PifMgr_OpenProperties(
    [MarshalAs(UnmanagedType.LPWStr)] string pszApp,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pszPIF,   // LPCWSTR optional
    uint hInf,   // DWORD
    uint flOpt   // DWORD
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function PifMgr_OpenProperties(
    <MarshalAs(UnmanagedType.LPWStr)> pszApp As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pszPIF As String,   ' LPCWSTR optional
    hInf As UInteger,   ' DWORD
    flOpt As UInteger   ' DWORD
) As IntPtr
End Function
' pszApp : LPCWSTR
' pszPIF : LPCWSTR optional
' hInf : DWORD
' flOpt : DWORD
Declare PtrSafe Function PifMgr_OpenProperties Lib "shell32" ( _
    ByVal pszApp As LongPtr, _
    ByVal pszPIF As LongPtr, _
    ByVal hInf As Long, _
    ByVal flOpt As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PifMgr_OpenProperties = ctypes.windll.shell32.PifMgr_OpenProperties
PifMgr_OpenProperties.restype = ctypes.c_void_p
PifMgr_OpenProperties.argtypes = [
    wintypes.LPCWSTR,  # pszApp : LPCWSTR
    wintypes.LPCWSTR,  # pszPIF : LPCWSTR optional
    wintypes.DWORD,  # hInf : DWORD
    wintypes.DWORD,  # flOpt : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procPifMgr_OpenProperties = shell32.NewProc("PifMgr_OpenProperties")
)

// pszApp (LPCWSTR), pszPIF (LPCWSTR optional), hInf (DWORD), flOpt (DWORD)
r1, _, err := procPifMgr_OpenProperties.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszApp))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPIF))),
	uintptr(hInf),
	uintptr(flOpt),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HANDLE
function PifMgr_OpenProperties(
  pszApp: PWideChar;   // LPCWSTR
  pszPIF: PWideChar;   // LPCWSTR optional
  hInf: DWORD;   // DWORD
  flOpt: DWORD   // DWORD
): THandle; stdcall;
  external 'SHELL32.dll' name 'PifMgr_OpenProperties';
result := DllCall("SHELL32\PifMgr_OpenProperties"
    , "WStr", pszApp   ; LPCWSTR
    , "WStr", pszPIF   ; LPCWSTR optional
    , "UInt", hInf   ; DWORD
    , "UInt", flOpt   ; DWORD
    , "Ptr")   ; return: HANDLE
●PifMgr_OpenProperties(pszApp, pszPIF, hInf, flOpt) = DLL("SHELL32.dll", "void* PifMgr_OpenProperties(char*, char*, dword, dword)")
# 呼び出し: PifMgr_OpenProperties(pszApp, pszPIF, hInf, flOpt)
# pszApp : LPCWSTR -> "char*"
# pszPIF : LPCWSTR optional -> "char*"
# hInf : DWORD -> "dword"
# flOpt : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。