ホーム › System.WindowsProgramming › LaunchINFSectionExW
LaunchINFSectionExW
関数INFセクションを拡張オプション付きで実行する(Unicode版)。
シグネチャ
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT LaunchINFSectionExW(
HWND hwnd, // optional
HINSTANCE hInstance, // optional
LPWSTR pszParms,
INT nShow
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | inoptional |
| hInstance | HINSTANCE | inoptional |
| pszParms | LPWSTR | in |
| nShow | INT | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT LaunchINFSectionExW(
HWND hwnd, // optional
HINSTANCE hInstance, // optional
LPWSTR pszParms,
INT nShow
);[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int LaunchINFSectionExW(
IntPtr hwnd, // HWND optional
IntPtr hInstance, // HINSTANCE optional
[MarshalAs(UnmanagedType.LPWStr)] string pszParms, // LPWSTR
int nShow // INT
);<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function LaunchINFSectionExW(
hwnd As IntPtr, ' HWND optional
hInstance As IntPtr, ' HINSTANCE optional
<MarshalAs(UnmanagedType.LPWStr)> pszParms As String, ' LPWSTR
nShow As Integer ' INT
) As Integer
End Function' hwnd : HWND optional
' hInstance : HINSTANCE optional
' pszParms : LPWSTR
' nShow : INT
Declare PtrSafe Function LaunchINFSectionExW 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
LaunchINFSectionExW = ctypes.windll.advpack.LaunchINFSectionExW
LaunchINFSectionExW.restype = ctypes.c_int
LaunchINFSectionExW.argtypes = [
wintypes.HANDLE, # hwnd : HWND optional
wintypes.HANDLE, # hInstance : HINSTANCE optional
wintypes.LPCWSTR, # pszParms : LPWSTR
ctypes.c_int, # nShow : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVPACK.dll')
LaunchINFSectionExW = Fiddle::Function.new(
lib['LaunchINFSectionExW'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND optional
Fiddle::TYPE_VOIDP, # hInstance : HINSTANCE optional
Fiddle::TYPE_VOIDP, # pszParms : LPWSTR
Fiddle::TYPE_INT, # nShow : INT
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "advpack")]
extern "system" {
fn LaunchINFSectionExW(
hwnd: *mut core::ffi::c_void, // HWND optional
hInstance: *mut core::ffi::c_void, // HINSTANCE optional
pszParms: *mut u16, // LPWSTR
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 LaunchINFSectionExW(IntPtr hwnd, IntPtr hInstance, [MarshalAs(UnmanagedType.LPWStr)] string pszParms, int nShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_LaunchINFSectionExW' -Namespace Win32 -PassThru
# $api::LaunchINFSectionExW(hwnd, hInstance, pszParms, nShow)#uselib "ADVPACK.dll"
#func global LaunchINFSectionExW "LaunchINFSectionExW" wptr, wptr, wptr, wptr
; LaunchINFSectionExW hwnd, hInstance, pszParms, nShow ; 戻り値は stat
; hwnd : HWND optional -> "wptr"
; hInstance : HINSTANCE optional -> "wptr"
; pszParms : LPWSTR -> "wptr"
; nShow : INT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVPACK.dll"
#cfunc global LaunchINFSectionExW "LaunchINFSectionExW" sptr, sptr, wstr, int
; res = LaunchINFSectionExW(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND optional -> "sptr"
; hInstance : HINSTANCE optional -> "sptr"
; pszParms : LPWSTR -> "wstr"
; nShow : INT -> "int"; HRESULT LaunchINFSectionExW(HWND hwnd, HINSTANCE hInstance, LPWSTR pszParms, INT nShow)
#uselib "ADVPACK.dll"
#cfunc global LaunchINFSectionExW "LaunchINFSectionExW" intptr, intptr, wstr, int
; res = LaunchINFSectionExW(hwnd, hInstance, pszParms, nShow)
; hwnd : HWND optional -> "intptr"
; hInstance : HINSTANCE optional -> "intptr"
; pszParms : LPWSTR -> "wstr"
; nShow : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advpack = windows.NewLazySystemDLL("ADVPACK.dll")
procLaunchINFSectionExW = advpack.NewProc("LaunchINFSectionExW")
)
// hwnd (HWND optional), hInstance (HINSTANCE optional), pszParms (LPWSTR), nShow (INT)
r1, _, err := procLaunchINFSectionExW.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 LaunchINFSectionExW(
hwnd: THandle; // HWND optional
hInstance: THandle; // HINSTANCE optional
pszParms: PWideChar; // LPWSTR
nShow: Integer // INT
): Integer; stdcall;
external 'ADVPACK.dll' name 'LaunchINFSectionExW';result := DllCall("ADVPACK\LaunchINFSectionExW"
, "Ptr", hwnd ; HWND optional
, "Ptr", hInstance ; HINSTANCE optional
, "WStr", pszParms ; LPWSTR
, "Int", nShow ; INT
, "Int") ; return: HRESULT●LaunchINFSectionExW(hwnd, hInstance, pszParms, nShow) = DLL("ADVPACK.dll", "int LaunchINFSectionExW(void*, void*, char*, int)")
# 呼び出し: LaunchINFSectionExW(hwnd, hInstance, pszParms, nShow)
# hwnd : HWND optional -> "void*"
# hInstance : HINSTANCE optional -> "void*"
# pszParms : LPWSTR -> "char*"
# nShow : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。