ホーム › System.WindowsProgramming › UserUnInstStubWrapperW
UserUnInstStubWrapperW
関数ユーザー単位アンインストールのスタブをラップ実行する(Unicode版)。
シグネチャ
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT UserUnInstStubWrapperW(
HWND hwnd,
HINSTANCE hInstance,
LPCWSTR pszParms,
INT nShow
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| hInstance | HINSTANCE | in |
| pszParms | LPCWSTR | in |
| nShow | INT | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT UserUnInstStubWrapperW(
HWND hwnd,
HINSTANCE hInstance,
LPCWSTR pszParms,
INT nShow
);[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int UserUnInstStubWrapperW(
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 UserUnInstStubWrapperW(
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 UserUnInstStubWrapperW 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
UserUnInstStubWrapperW = ctypes.windll.advpack.UserUnInstStubWrapperW
UserUnInstStubWrapperW.restype = ctypes.c_int
UserUnInstStubWrapperW.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')
UserUnInstStubWrapperW = Fiddle::Function.new(
lib['UserUnInstStubWrapperW'],
[
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 UserUnInstStubWrapperW(
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 UserUnInstStubWrapperW(IntPtr hwnd, IntPtr hInstance, [MarshalAs(UnmanagedType.LPWStr)] string pszParms, int nShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_UserUnInstStubWrapperW' -Namespace Win32 -PassThru
# $api::UserUnInstStubWrapperW(hwnd, hInstance, pszParms, nShow)#uselib "ADVPACK.dll"
#func global UserUnInstStubWrapperW "UserUnInstStubWrapperW" wptr, wptr, wptr, wptr
; UserUnInstStubWrapperW 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 UserUnInstStubWrapperW "UserUnInstStubWrapperW" sptr, sptr, wstr, int
; res = UserUnInstStubWrapperW(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND -> "sptr"
; hInstance : HINSTANCE -> "sptr"
; pszParms : LPCWSTR -> "wstr"
; nShow : INT -> "int"; HRESULT UserUnInstStubWrapperW(HWND hwnd, HINSTANCE hInstance, LPCWSTR pszParms, INT nShow)
#uselib "ADVPACK.dll"
#cfunc global UserUnInstStubWrapperW "UserUnInstStubWrapperW" intptr, intptr, wstr, int
; res = UserUnInstStubWrapperW(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")
procUserUnInstStubWrapperW = advpack.NewProc("UserUnInstStubWrapperW")
)
// hwnd (HWND), hInstance (HINSTANCE), pszParms (LPCWSTR), nShow (INT)
r1, _, err := procUserUnInstStubWrapperW.Call(
uintptr(hwnd),
uintptr(hInstance),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszParms))),
uintptr(nShow),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction UserUnInstStubWrapperW(
hwnd: THandle; // HWND
hInstance: THandle; // HINSTANCE
pszParms: PWideChar; // LPCWSTR
nShow: Integer // INT
): Integer; stdcall;
external 'ADVPACK.dll' name 'UserUnInstStubWrapperW';result := DllCall("ADVPACK\UserUnInstStubWrapperW"
, "Ptr", hwnd ; HWND
, "Ptr", hInstance ; HINSTANCE
, "WStr", pszParms ; LPCWSTR
, "Int", nShow ; INT
, "Int") ; return: HRESULT●UserUnInstStubWrapperW(hwnd, hInstance, pszParms, nShow) = DLL("ADVPACK.dll", "int UserUnInstStubWrapperW(void*, void*, char*, int)")
# 呼び出し: UserUnInstStubWrapperW(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 版の利用を推奨。