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

LaunchINFSectionW

関数
INFセクションを起動して実行する(Unicode版)。
DLLADVPACK.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT LaunchINFSectionW(
    HWND hwndOwner,
    HINSTANCE hInstance,
    LPWSTR pszParams,
    INT nShow
);

パラメーター

名前方向
hwndOwnerHWNDin
hInstanceHINSTANCEin
pszParamsLPWSTRinout
nShowINTin

戻り値の型: INT

各言語での呼び出し定義

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

INT LaunchINFSectionW(
    HWND hwndOwner,
    HINSTANCE hInstance,
    LPWSTR pszParams,
    INT nShow
);
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int LaunchINFSectionW(
    IntPtr hwndOwner,   // HWND
    IntPtr hInstance,   // HINSTANCE
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszParams,   // LPWSTR in/out
    int nShow   // INT
);
<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function LaunchINFSectionW(
    hwndOwner As IntPtr,   ' HWND
    hInstance As IntPtr,   ' HINSTANCE
    <MarshalAs(UnmanagedType.LPWStr)> pszParams As System.Text.StringBuilder,   ' LPWSTR in/out
    nShow As Integer   ' INT
) As Integer
End Function
' hwndOwner : HWND
' hInstance : HINSTANCE
' pszParams : LPWSTR in/out
' nShow : INT
Declare PtrSafe Function LaunchINFSectionW Lib "advpack" ( _
    ByVal hwndOwner As LongPtr, _
    ByVal hInstance As LongPtr, _
    ByVal pszParams 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

LaunchINFSectionW = ctypes.windll.advpack.LaunchINFSectionW
LaunchINFSectionW.restype = ctypes.c_int
LaunchINFSectionW.argtypes = [
    wintypes.HANDLE,  # hwndOwner : HWND
    wintypes.HANDLE,  # hInstance : HINSTANCE
    wintypes.LPWSTR,  # pszParams : LPWSTR in/out
    ctypes.c_int,  # nShow : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVPACK.dll')
LaunchINFSectionW = Fiddle::Function.new(
  lib['LaunchINFSectionW'],
  [
    Fiddle::TYPE_VOIDP,  # hwndOwner : HWND
    Fiddle::TYPE_VOIDP,  # hInstance : HINSTANCE
    Fiddle::TYPE_VOIDP,  # pszParams : LPWSTR in/out
    Fiddle::TYPE_INT,  # nShow : INT
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "advpack")]
extern "system" {
    fn LaunchINFSectionW(
        hwndOwner: *mut core::ffi::c_void,  // HWND
        hInstance: *mut core::ffi::c_void,  // HINSTANCE
        pszParams: *mut u16,  // LPWSTR in/out
        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 LaunchINFSectionW(IntPtr hwndOwner, IntPtr hInstance, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszParams, int nShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_LaunchINFSectionW' -Namespace Win32 -PassThru
# $api::LaunchINFSectionW(hwndOwner, hInstance, pszParams, nShow)
#uselib "ADVPACK.dll"
#func global LaunchINFSectionW "LaunchINFSectionW" wptr, wptr, wptr, wptr
; LaunchINFSectionW hwndOwner, hInstance, varptr(pszParams), nShow   ; 戻り値は stat
; hwndOwner : HWND -> "wptr"
; hInstance : HINSTANCE -> "wptr"
; pszParams : LPWSTR in/out -> "wptr"
; nShow : INT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ADVPACK.dll"
#cfunc global LaunchINFSectionW "LaunchINFSectionW" sptr, sptr, var, int
; res = LaunchINFSectionW(hwndOwner, hInstance, pszParams, nShow)
; hwndOwner : HWND -> "sptr"
; hInstance : HINSTANCE -> "sptr"
; pszParams : LPWSTR in/out -> "var"
; nShow : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT LaunchINFSectionW(HWND hwndOwner, HINSTANCE hInstance, LPWSTR pszParams, INT nShow)
#uselib "ADVPACK.dll"
#cfunc global LaunchINFSectionW "LaunchINFSectionW" intptr, intptr, var, int
; res = LaunchINFSectionW(hwndOwner, hInstance, pszParams, nShow)
; hwndOwner : HWND -> "intptr"
; hInstance : HINSTANCE -> "intptr"
; pszParams : LPWSTR in/out -> "var"
; nShow : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advpack = windows.NewLazySystemDLL("ADVPACK.dll")
	procLaunchINFSectionW = advpack.NewProc("LaunchINFSectionW")
)

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