ホーム › System.WindowsProgramming › UserUnInstStubWrapperA
UserUnInstStubWrapperA
関数ユーザー単位アンインストールのスタブをラップ実行する(ANSI版)。
シグネチャ
// ADVPACK.dll (ANSI / -A)
#include <windows.h>
HRESULT UserUnInstStubWrapperA(
HWND hwnd,
HINSTANCE hInstance,
LPCSTR pszParms,
INT nShow
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| hInstance | HINSTANCE | in |
| pszParms | LPCSTR | in |
| nShow | INT | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// ADVPACK.dll (ANSI / -A)
#include <windows.h>
HRESULT UserUnInstStubWrapperA(
HWND hwnd,
HINSTANCE hInstance,
LPCSTR pszParms,
INT nShow
);[DllImport("ADVPACK.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int UserUnInstStubWrapperA(
IntPtr hwnd, // HWND
IntPtr hInstance, // HINSTANCE
[MarshalAs(UnmanagedType.LPStr)] string pszParms, // LPCSTR
int nShow // INT
);<DllImport("ADVPACK.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function UserUnInstStubWrapperA(
hwnd As IntPtr, ' HWND
hInstance As IntPtr, ' HINSTANCE
<MarshalAs(UnmanagedType.LPStr)> pszParms As String, ' LPCSTR
nShow As Integer ' INT
) As Integer
End Function' hwnd : HWND
' hInstance : HINSTANCE
' pszParms : LPCSTR
' nShow : INT
Declare PtrSafe Function UserUnInstStubWrapperA Lib "advpack" ( _
ByVal hwnd As LongPtr, _
ByVal hInstance As LongPtr, _
ByVal pszParms As String, _
ByVal nShow As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
UserUnInstStubWrapperA = ctypes.windll.advpack.UserUnInstStubWrapperA
UserUnInstStubWrapperA.restype = ctypes.c_int
UserUnInstStubWrapperA.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.HANDLE, # hInstance : HINSTANCE
wintypes.LPCSTR, # pszParms : LPCSTR
ctypes.c_int, # nShow : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVPACK.dll')
UserUnInstStubWrapperA = Fiddle::Function.new(
lib['UserUnInstStubWrapperA'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # hInstance : HINSTANCE
Fiddle::TYPE_VOIDP, # pszParms : LPCSTR
Fiddle::TYPE_INT, # nShow : INT
],
Fiddle::TYPE_INT)#[link(name = "advpack")]
extern "system" {
fn UserUnInstStubWrapperA(
hwnd: *mut core::ffi::c_void, // HWND
hInstance: *mut core::ffi::c_void, // HINSTANCE
pszParms: *const u8, // LPCSTR
nShow: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Ansi)]
public static extern int UserUnInstStubWrapperA(IntPtr hwnd, IntPtr hInstance, [MarshalAs(UnmanagedType.LPStr)] string pszParms, int nShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_UserUnInstStubWrapperA' -Namespace Win32 -PassThru
# $api::UserUnInstStubWrapperA(hwnd, hInstance, pszParms, nShow)#uselib "ADVPACK.dll"
#func global UserUnInstStubWrapperA "UserUnInstStubWrapperA" sptr, sptr, sptr, sptr
; UserUnInstStubWrapperA hwnd, hInstance, pszParms, nShow ; 戻り値は stat
; hwnd : HWND -> "sptr"
; hInstance : HINSTANCE -> "sptr"
; pszParms : LPCSTR -> "sptr"
; nShow : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVPACK.dll"
#cfunc global UserUnInstStubWrapperA "UserUnInstStubWrapperA" sptr, sptr, str, int
; res = UserUnInstStubWrapperA(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND -> "sptr"
; hInstance : HINSTANCE -> "sptr"
; pszParms : LPCSTR -> "str"
; nShow : INT -> "int"; HRESULT UserUnInstStubWrapperA(HWND hwnd, HINSTANCE hInstance, LPCSTR pszParms, INT nShow)
#uselib "ADVPACK.dll"
#cfunc global UserUnInstStubWrapperA "UserUnInstStubWrapperA" intptr, intptr, str, int
; res = UserUnInstStubWrapperA(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND -> "intptr"
; hInstance : HINSTANCE -> "intptr"
; pszParms : LPCSTR -> "str"
; nShow : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advpack = windows.NewLazySystemDLL("ADVPACK.dll")
procUserUnInstStubWrapperA = advpack.NewProc("UserUnInstStubWrapperA")
)
// hwnd (HWND), hInstance (HINSTANCE), pszParms (LPCSTR), nShow (INT)
r1, _, err := procUserUnInstStubWrapperA.Call(
uintptr(hwnd),
uintptr(hInstance),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszParms))),
uintptr(nShow),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction UserUnInstStubWrapperA(
hwnd: THandle; // HWND
hInstance: THandle; // HINSTANCE
pszParms: PAnsiChar; // LPCSTR
nShow: Integer // INT
): Integer; stdcall;
external 'ADVPACK.dll' name 'UserUnInstStubWrapperA';result := DllCall("ADVPACK\UserUnInstStubWrapperA"
, "Ptr", hwnd ; HWND
, "Ptr", hInstance ; HINSTANCE
, "AStr", pszParms ; LPCSTR
, "Int", nShow ; INT
, "Int") ; return: HRESULT●UserUnInstStubWrapperA(hwnd, hInstance, pszParms, nShow) = DLL("ADVPACK.dll", "int UserUnInstStubWrapperA(void*, void*, char*, int)")
# 呼び出し: UserUnInstStubWrapperA(hwnd, hInstance, pszParms, nShow)
# hwnd : HWND -> "void*"
# hInstance : HINSTANCE -> "void*"
# pszParms : LPCSTR -> "char*"
# nShow : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。