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

MsiDatabaseOpenViewA

関数
インストールデータベースに対するSQLクエリのビューを開く。
DLLmsi.dll文字セットANSI (-A)呼出規約winapi対応OSwindows8.0

シグネチャ

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiDatabaseOpenViewA(
    MSIHANDLE hDatabase,
    LPCSTR szQuery,
    MSIHANDLE* phView
);

パラメーター

名前方向
hDatabaseMSIHANDLEin
szQueryLPCSTRin
phViewMSIHANDLE*inout

戻り値の型: DWORD

各言語での呼び出し定義

// msi.dll  (ANSI / -A)
#include <windows.h>

DWORD MsiDatabaseOpenViewA(
    MSIHANDLE hDatabase,
    LPCSTR szQuery,
    MSIHANDLE* phView
);
[DllImport("msi.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint MsiDatabaseOpenViewA(
    uint hDatabase,   // MSIHANDLE
    [MarshalAs(UnmanagedType.LPStr)] string szQuery,   // LPCSTR
    ref uint phView   // MSIHANDLE* in/out
);
<DllImport("msi.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function MsiDatabaseOpenViewA(
    hDatabase As UInteger,   ' MSIHANDLE
    <MarshalAs(UnmanagedType.LPStr)> szQuery As String,   ' LPCSTR
    ByRef phView As UInteger   ' MSIHANDLE* in/out
) As UInteger
End Function
' hDatabase : MSIHANDLE
' szQuery : LPCSTR
' phView : MSIHANDLE* in/out
Declare PtrSafe Function MsiDatabaseOpenViewA Lib "msi" ( _
    ByVal hDatabase As Long, _
    ByVal szQuery As String, _
    ByRef phView As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiDatabaseOpenViewA = ctypes.windll.msi.MsiDatabaseOpenViewA
MsiDatabaseOpenViewA.restype = wintypes.DWORD
MsiDatabaseOpenViewA.argtypes = [
    wintypes.DWORD,  # hDatabase : MSIHANDLE
    wintypes.LPCSTR,  # szQuery : LPCSTR
    ctypes.c_void_p,  # phView : MSIHANDLE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiDatabaseOpenViewA = Fiddle::Function.new(
  lib['MsiDatabaseOpenViewA'],
  [
    -Fiddle::TYPE_INT,  # hDatabase : MSIHANDLE
    Fiddle::TYPE_VOIDP,  # szQuery : LPCSTR
    Fiddle::TYPE_VOIDP,  # phView : MSIHANDLE* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiDatabaseOpenViewA(
        hDatabase: u32,  // MSIHANDLE
        szQuery: *const u8,  // LPCSTR
        phView: *mut u32  // MSIHANDLE* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Ansi)]
public static extern uint MsiDatabaseOpenViewA(uint hDatabase, [MarshalAs(UnmanagedType.LPStr)] string szQuery, ref uint phView);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiDatabaseOpenViewA' -Namespace Win32 -PassThru
# $api::MsiDatabaseOpenViewA(hDatabase, szQuery, phView)
#uselib "msi.dll"
#func global MsiDatabaseOpenViewA "MsiDatabaseOpenViewA" sptr, sptr, sptr
; MsiDatabaseOpenViewA hDatabase, szQuery, phView   ; 戻り値は stat
; hDatabase : MSIHANDLE -> "sptr"
; szQuery : LPCSTR -> "sptr"
; phView : MSIHANDLE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiDatabaseOpenViewA "MsiDatabaseOpenViewA" int, str, int
; res = MsiDatabaseOpenViewA(hDatabase, szQuery, phView)
; hDatabase : MSIHANDLE -> "int"
; szQuery : LPCSTR -> "str"
; phView : MSIHANDLE* in/out -> "int"
; DWORD MsiDatabaseOpenViewA(MSIHANDLE hDatabase, LPCSTR szQuery, MSIHANDLE* phView)
#uselib "msi.dll"
#cfunc global MsiDatabaseOpenViewA "MsiDatabaseOpenViewA" int, str, int
; res = MsiDatabaseOpenViewA(hDatabase, szQuery, phView)
; hDatabase : MSIHANDLE -> "int"
; szQuery : LPCSTR -> "str"
; phView : MSIHANDLE* in/out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiDatabaseOpenViewA = msi.NewProc("MsiDatabaseOpenViewA")
)

// hDatabase (MSIHANDLE), szQuery (LPCSTR), phView (MSIHANDLE* in/out)
r1, _, err := procMsiDatabaseOpenViewA.Call(
	uintptr(hDatabase),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(szQuery))),
	uintptr(phView),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MsiDatabaseOpenViewA(
  hDatabase: DWORD;   // MSIHANDLE
  szQuery: PAnsiChar;   // LPCSTR
  phView: Pointer   // MSIHANDLE* in/out
): DWORD; stdcall;
  external 'msi.dll' name 'MsiDatabaseOpenViewA';
result := DllCall("msi\MsiDatabaseOpenViewA"
    , "UInt", hDatabase   ; MSIHANDLE
    , "AStr", szQuery   ; LPCSTR
    , "Ptr", phView   ; MSIHANDLE* in/out
    , "UInt")   ; return: DWORD
●MsiDatabaseOpenViewA(hDatabase, szQuery, phView) = DLL("msi.dll", "dword MsiDatabaseOpenViewA(dword, char*, void*)")
# 呼び出し: MsiDatabaseOpenViewA(hDatabase, szQuery, phView)
# hDatabase : MSIHANDLE -> "dword"
# szQuery : LPCSTR -> "char*"
# phView : MSIHANDLE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。