ホーム › System.ApplicationInstallationAndServicing › MsiQueryProductStateW
MsiQueryProductStateW
関数指定製品のインストール状態を問い合わせる(Unicode版)。
シグネチャ
// msi.dll (Unicode / -W)
#include <windows.h>
INSTALLSTATE MsiQueryProductStateW(
LPCWSTR szProduct
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szProduct | LPCWSTR | in |
戻り値の型: INSTALLSTATE
各言語での呼び出し定義
// msi.dll (Unicode / -W)
#include <windows.h>
INSTALLSTATE MsiQueryProductStateW(
LPCWSTR szProduct
);[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int MsiQueryProductStateW(
[MarshalAs(UnmanagedType.LPWStr)] string szProduct // LPCWSTR
);<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiQueryProductStateW(
<MarshalAs(UnmanagedType.LPWStr)> szProduct As String ' LPCWSTR
) As Integer
End Function' szProduct : LPCWSTR
Declare PtrSafe Function MsiQueryProductStateW Lib "msi" ( _
ByVal szProduct As LongPtr) 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
MsiQueryProductStateW = ctypes.windll.msi.MsiQueryProductStateW
MsiQueryProductStateW.restype = ctypes.c_int
MsiQueryProductStateW.argtypes = [
wintypes.LPCWSTR, # szProduct : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msi.dll')
MsiQueryProductStateW = Fiddle::Function.new(
lib['MsiQueryProductStateW'],
[
Fiddle::TYPE_VOIDP, # szProduct : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msi")]
extern "system" {
fn MsiQueryProductStateW(
szProduct: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern int MsiQueryProductStateW([MarshalAs(UnmanagedType.LPWStr)] string szProduct);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiQueryProductStateW' -Namespace Win32 -PassThru
# $api::MsiQueryProductStateW(szProduct)#uselib "msi.dll"
#func global MsiQueryProductStateW "MsiQueryProductStateW" wptr
; MsiQueryProductStateW szProduct ; 戻り値は stat
; szProduct : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msi.dll"
#cfunc global MsiQueryProductStateW "MsiQueryProductStateW" wstr
; res = MsiQueryProductStateW(szProduct)
; szProduct : LPCWSTR -> "wstr"; INSTALLSTATE MsiQueryProductStateW(LPCWSTR szProduct)
#uselib "msi.dll"
#cfunc global MsiQueryProductStateW "MsiQueryProductStateW" wstr
; res = MsiQueryProductStateW(szProduct)
; szProduct : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msi = windows.NewLazySystemDLL("msi.dll")
procMsiQueryProductStateW = msi.NewProc("MsiQueryProductStateW")
)
// szProduct (LPCWSTR)
r1, _, err := procMsiQueryProductStateW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szProduct))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INSTALLSTATEfunction MsiQueryProductStateW(
szProduct: PWideChar // LPCWSTR
): Integer; stdcall;
external 'msi.dll' name 'MsiQueryProductStateW';result := DllCall("msi\MsiQueryProductStateW"
, "WStr", szProduct ; LPCWSTR
, "Int") ; return: INSTALLSTATE●MsiQueryProductStateW(szProduct) = DLL("msi.dll", "int MsiQueryProductStateW(char*)")
# 呼び出し: MsiQueryProductStateW(szProduct)
# szProduct : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。