Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › UserInstStubWrapperW

UserInstStubWrapperW

関数
ユーザー単位インストールのスタブをラップ実行する(Unicode版)。
DLLADVPACK.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT UserInstStubWrapperW(
    HWND hwnd,
    HINSTANCE hInstance,
    LPCWSTR pszParms,
    INT nShow
);

パラメーター

名前方向
hwndHWNDin
hInstanceHINSTANCEin
pszParmsLPCWSTRin
nShowINTin

戻り値の型: HRESULT

各言語での呼び出し定義

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT UserInstStubWrapperW(
    HWND hwnd,
    HINSTANCE hInstance,
    LPCWSTR pszParms,
    INT nShow
);
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int UserInstStubWrapperW(
    IntPtr hwnd,   // HWND
    IntPtr hInstance,   // HINSTANCE
    [MarshalAs(UnmanagedType.LPWStr)] string pszParms,   // LPCWSTR
    int nShow   // INT
);
<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function UserInstStubWrapperW(
    hwnd As IntPtr,   ' HWND
    hInstance As IntPtr,   ' HINSTANCE
    <MarshalAs(UnmanagedType.LPWStr)> pszParms As String,   ' LPCWSTR
    nShow As Integer   ' INT
) As Integer
End Function
' hwnd : HWND
' hInstance : HINSTANCE
' pszParms : LPCWSTR
' nShow : INT
Declare PtrSafe Function UserInstStubWrapperW Lib "advpack" ( _
    ByVal hwnd As LongPtr, _
    ByVal hInstance As LongPtr, _
    ByVal pszParms As LongPtr, _
    ByVal nShow As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UserInstStubWrapperW = ctypes.windll.advpack.UserInstStubWrapperW
UserInstStubWrapperW.restype = ctypes.c_int
UserInstStubWrapperW.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    wintypes.HANDLE,  # hInstance : HINSTANCE
    wintypes.LPCWSTR,  # pszParms : LPCWSTR
    ctypes.c_int,  # nShow : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVPACK.dll')
UserInstStubWrapperW = Fiddle::Function.new(
  lib['UserInstStubWrapperW'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_VOIDP,  # hInstance : HINSTANCE
    Fiddle::TYPE_VOIDP,  # pszParms : LPCWSTR
    Fiddle::TYPE_INT,  # nShow : INT
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "advpack")]
extern "system" {
    fn UserInstStubWrapperW(
        hwnd: *mut core::ffi::c_void,  // HWND
        hInstance: *mut core::ffi::c_void,  // HINSTANCE
        pszParms: *const u16,  // LPCWSTR
        nShow: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode)]
public static extern int UserInstStubWrapperW(IntPtr hwnd, IntPtr hInstance, [MarshalAs(UnmanagedType.LPWStr)] string pszParms, int nShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_UserInstStubWrapperW' -Namespace Win32 -PassThru
# $api::UserInstStubWrapperW(hwnd, hInstance, pszParms, nShow)
#uselib "ADVPACK.dll"
#func global UserInstStubWrapperW "UserInstStubWrapperW" wptr, wptr, wptr, wptr
; UserInstStubWrapperW hwnd, hInstance, pszParms, nShow   ; 戻り値は stat
; hwnd : HWND -> "wptr"
; hInstance : HINSTANCE -> "wptr"
; pszParms : LPCWSTR -> "wptr"
; nShow : INT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVPACK.dll"
#cfunc global UserInstStubWrapperW "UserInstStubWrapperW" sptr, sptr, wstr, int
; res = UserInstStubWrapperW(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND -> "sptr"
; hInstance : HINSTANCE -> "sptr"
; pszParms : LPCWSTR -> "wstr"
; nShow : INT -> "int"
; HRESULT UserInstStubWrapperW(HWND hwnd, HINSTANCE hInstance, LPCWSTR pszParms, INT nShow)
#uselib "ADVPACK.dll"
#cfunc global UserInstStubWrapperW "UserInstStubWrapperW" intptr, intptr, wstr, int
; res = UserInstStubWrapperW(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND -> "intptr"
; hInstance : HINSTANCE -> "intptr"
; pszParms : LPCWSTR -> "wstr"
; nShow : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advpack = windows.NewLazySystemDLL("ADVPACK.dll")
	procUserInstStubWrapperW = advpack.NewProc("UserInstStubWrapperW")
)

// hwnd (HWND), hInstance (HINSTANCE), pszParms (LPCWSTR), nShow (INT)
r1, _, err := procUserInstStubWrapperW.Call(
	uintptr(hwnd),
	uintptr(hInstance),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszParms))),
	uintptr(nShow),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function UserInstStubWrapperW(
  hwnd: THandle;   // HWND
  hInstance: THandle;   // HINSTANCE
  pszParms: PWideChar;   // LPCWSTR
  nShow: Integer   // INT
): Integer; stdcall;
  external 'ADVPACK.dll' name 'UserInstStubWrapperW';
result := DllCall("ADVPACK\UserInstStubWrapperW"
    , "Ptr", hwnd   ; HWND
    , "Ptr", hInstance   ; HINSTANCE
    , "WStr", pszParms   ; LPCWSTR
    , "Int", nShow   ; INT
    , "Int")   ; return: HRESULT
●UserInstStubWrapperW(hwnd, hInstance, pszParms, nShow) = DLL("ADVPACK.dll", "int UserInstStubWrapperW(void*, void*, char*, int)")
# 呼び出し: UserInstStubWrapperW(hwnd, hInstance, pszParms, nShow)
# hwnd : HWND -> "void*"
# hInstance : HINSTANCE -> "void*"
# pszParms : LPCWSTR -> "char*"
# nShow : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。