Win32 API 日本語リファレンス
ホームStorage.Jet › JetGetCurrentIndexA

JetGetCurrentIndexA

関数
カーソルの現在のインデックス名を取得する(ANSI版)。
DLLESENT.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

INT JetGetCurrentIndexA(
    JET_SESID sesid,
    JET_TABLEID tableid,
    CHAR* szIndexName,
    DWORD cbIndexName
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
szIndexNameCHAR*out
cbIndexNameDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

INT JetGetCurrentIndexA(
    JET_SESID sesid,
    JET_TABLEID tableid,
    CHAR* szIndexName,
    DWORD cbIndexName
);
[DllImport("ESENT.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int JetGetCurrentIndexA(
    UIntPtr sesid,   // JET_SESID
    UIntPtr tableid,   // JET_TABLEID
    IntPtr szIndexName,   // CHAR* out
    uint cbIndexName   // DWORD
);
<DllImport("ESENT.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function JetGetCurrentIndexA(
    sesid As UIntPtr,   ' JET_SESID
    tableid As UIntPtr,   ' JET_TABLEID
    szIndexName As IntPtr,   ' CHAR* out
    cbIndexName As UInteger   ' DWORD
) As Integer
End Function
' sesid : JET_SESID
' tableid : JET_TABLEID
' szIndexName : CHAR* out
' cbIndexName : DWORD
Declare PtrSafe Function JetGetCurrentIndexA Lib "esent" ( _
    ByVal sesid As LongPtr, _
    ByVal tableid As LongPtr, _
    ByVal szIndexName As LongPtr, _
    ByVal cbIndexName As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

JetGetCurrentIndexA = ctypes.windll.esent.JetGetCurrentIndexA
JetGetCurrentIndexA.restype = ctypes.c_int
JetGetCurrentIndexA.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    ctypes.c_size_t,  # tableid : JET_TABLEID
    ctypes.POINTER(ctypes.c_byte),  # szIndexName : CHAR* out
    wintypes.DWORD,  # cbIndexName : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ESENT.dll')
JetGetCurrentIndexA = Fiddle::Function.new(
  lib['JetGetCurrentIndexA'],
  [
    Fiddle::TYPE_UINTPTR_T,  # sesid : JET_SESID
    Fiddle::TYPE_UINTPTR_T,  # tableid : JET_TABLEID
    Fiddle::TYPE_VOIDP,  # szIndexName : CHAR* out
    -Fiddle::TYPE_INT,  # cbIndexName : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "esent")]
extern "system" {
    fn JetGetCurrentIndexA(
        sesid: usize,  // JET_SESID
        tableid: usize,  // JET_TABLEID
        szIndexName: *mut i8,  // CHAR* out
        cbIndexName: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ESENT.dll", CharSet = CharSet.Ansi)]
public static extern int JetGetCurrentIndexA(UIntPtr sesid, UIntPtr tableid, IntPtr szIndexName, uint cbIndexName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetGetCurrentIndexA' -Namespace Win32 -PassThru
# $api::JetGetCurrentIndexA(sesid, tableid, szIndexName, cbIndexName)
#uselib "ESENT.dll"
#func global JetGetCurrentIndexA "JetGetCurrentIndexA" sptr, sptr, sptr, sptr
; JetGetCurrentIndexA sesid, tableid, varptr(szIndexName), cbIndexName   ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; szIndexName : CHAR* out -> "sptr"
; cbIndexName : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ESENT.dll"
#cfunc global JetGetCurrentIndexA "JetGetCurrentIndexA" sptr, sptr, var, int
; res = JetGetCurrentIndexA(sesid, tableid, szIndexName, cbIndexName)
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; szIndexName : CHAR* out -> "var"
; cbIndexName : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT JetGetCurrentIndexA(JET_SESID sesid, JET_TABLEID tableid, CHAR* szIndexName, DWORD cbIndexName)
#uselib "ESENT.dll"
#cfunc global JetGetCurrentIndexA "JetGetCurrentIndexA" intptr, intptr, var, int
; res = JetGetCurrentIndexA(sesid, tableid, szIndexName, cbIndexName)
; sesid : JET_SESID -> "intptr"
; tableid : JET_TABLEID -> "intptr"
; szIndexName : CHAR* out -> "var"
; cbIndexName : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetGetCurrentIndexA = esent.NewProc("JetGetCurrentIndexA")
)

// sesid (JET_SESID), tableid (JET_TABLEID), szIndexName (CHAR* out), cbIndexName (DWORD)
r1, _, err := procJetGetCurrentIndexA.Call(
	uintptr(sesid),
	uintptr(tableid),
	uintptr(szIndexName),
	uintptr(cbIndexName),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function JetGetCurrentIndexA(
  sesid: NativeUInt;   // JET_SESID
  tableid: NativeUInt;   // JET_TABLEID
  szIndexName: Pointer;   // CHAR* out
  cbIndexName: DWORD   // DWORD
): Integer; stdcall;
  external 'ESENT.dll' name 'JetGetCurrentIndexA';
result := DllCall("ESENT\JetGetCurrentIndexA"
    , "UPtr", sesid   ; JET_SESID
    , "UPtr", tableid   ; JET_TABLEID
    , "Ptr", szIndexName   ; CHAR* out
    , "UInt", cbIndexName   ; DWORD
    , "Int")   ; return: INT
●JetGetCurrentIndexA(sesid, tableid, szIndexName, cbIndexName) = DLL("ESENT.dll", "int JetGetCurrentIndexA(int, int, void*, dword)")
# 呼び出し: JetGetCurrentIndexA(sesid, tableid, szIndexName, cbIndexName)
# sesid : JET_SESID -> "int"
# tableid : JET_TABLEID -> "int"
# szIndexName : CHAR* out -> "void*"
# cbIndexName : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。