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

MsiRecordGetInteger

関数
レコードの指定フィールドから整数値を取得する。
DLLmsi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll
#include <windows.h>

INT MsiRecordGetInteger(
    MSIHANDLE hRecord,
    DWORD iField
);

パラメーター

名前方向
hRecordMSIHANDLEin
iFieldDWORDin

戻り値の型: INT

各言語での呼び出し定義

// msi.dll
#include <windows.h>

INT MsiRecordGetInteger(
    MSIHANDLE hRecord,
    DWORD iField
);
[DllImport("msi.dll", ExactSpelling = true)]
static extern int MsiRecordGetInteger(
    uint hRecord,   // MSIHANDLE
    uint iField   // DWORD
);
<DllImport("msi.dll", ExactSpelling:=True)>
Public Shared Function MsiRecordGetInteger(
    hRecord As UInteger,   ' MSIHANDLE
    iField As UInteger   ' DWORD
) As Integer
End Function
' hRecord : MSIHANDLE
' iField : DWORD
Declare PtrSafe Function MsiRecordGetInteger Lib "msi" ( _
    ByVal hRecord As Long, _
    ByVal iField As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiRecordGetInteger = ctypes.windll.msi.MsiRecordGetInteger
MsiRecordGetInteger.restype = ctypes.c_int
MsiRecordGetInteger.argtypes = [
    wintypes.DWORD,  # hRecord : MSIHANDLE
    wintypes.DWORD,  # iField : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiRecordGetInteger = Fiddle::Function.new(
  lib['MsiRecordGetInteger'],
  [
    -Fiddle::TYPE_INT,  # hRecord : MSIHANDLE
    -Fiddle::TYPE_INT,  # iField : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiRecordGetInteger(
        hRecord: u32,  // MSIHANDLE
        iField: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll")]
public static extern int MsiRecordGetInteger(uint hRecord, uint iField);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiRecordGetInteger' -Namespace Win32 -PassThru
# $api::MsiRecordGetInteger(hRecord, iField)
#uselib "msi.dll"
#func global MsiRecordGetInteger "MsiRecordGetInteger" sptr, sptr
; MsiRecordGetInteger hRecord, iField   ; 戻り値は stat
; hRecord : MSIHANDLE -> "sptr"
; iField : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiRecordGetInteger "MsiRecordGetInteger" int, int
; res = MsiRecordGetInteger(hRecord, iField)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
; INT MsiRecordGetInteger(MSIHANDLE hRecord, DWORD iField)
#uselib "msi.dll"
#cfunc global MsiRecordGetInteger "MsiRecordGetInteger" int, int
; res = MsiRecordGetInteger(hRecord, iField)
; hRecord : MSIHANDLE -> "int"
; iField : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiRecordGetInteger = msi.NewProc("MsiRecordGetInteger")
)

// hRecord (MSIHANDLE), iField (DWORD)
r1, _, err := procMsiRecordGetInteger.Call(
	uintptr(hRecord),
	uintptr(iField),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function MsiRecordGetInteger(
  hRecord: DWORD;   // MSIHANDLE
  iField: DWORD   // DWORD
): Integer; stdcall;
  external 'msi.dll' name 'MsiRecordGetInteger';
result := DllCall("msi\MsiRecordGetInteger"
    , "UInt", hRecord   ; MSIHANDLE
    , "UInt", iField   ; DWORD
    , "Int")   ; return: INT
●MsiRecordGetInteger(hRecord, iField) = DLL("msi.dll", "int MsiRecordGetInteger(dword, dword)")
# 呼び出し: MsiRecordGetInteger(hRecord, iField)
# hRecord : MSIHANDLE -> "dword"
# iField : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。