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