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

JetGetRecordPosition

関数
現在のレコードのインデックス上の位置を取得する。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetGetRecordPosition(
    JET_SESID sesid,
    JET_TABLEID tableid,
    JET_RECPOS* precpos,
    DWORD cbRecpos
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
precposJET_RECPOS*out
cbRecposDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

JetGetRecordPosition = ctypes.windll.esent.JetGetRecordPosition
JetGetRecordPosition.restype = ctypes.c_int
JetGetRecordPosition.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    ctypes.c_size_t,  # tableid : JET_TABLEID
    ctypes.c_void_p,  # precpos : JET_RECPOS* out
    wintypes.DWORD,  # cbRecpos : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetGetRecordPosition = esent.NewProc("JetGetRecordPosition")
)

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