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

JetSetCurrentIndex4A

関数
インデックスIDを用いて現在のインデックスを設定する(ANSI版)。
DLLESENT.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

INT JetSetCurrentIndex4A(
    JET_SESID sesid,
    JET_TABLEID tableid,
    CHAR* szIndexName,   // optional
    JET_INDEXID* pindexid,   // optional
    DWORD grbit,
    DWORD itagSequence
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
szIndexNameCHAR*inoptional
pindexidJET_INDEXID*inoptional
grbitDWORDin
itagSequenceDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

JetSetCurrentIndex4A = ctypes.windll.esent.JetSetCurrentIndex4A
JetSetCurrentIndex4A.restype = ctypes.c_int
JetSetCurrentIndex4A.argtypes = [
    ctypes.c_size_t,  # sesid : JET_SESID
    ctypes.c_size_t,  # tableid : JET_TABLEID
    ctypes.POINTER(ctypes.c_byte),  # szIndexName : CHAR* optional
    ctypes.c_void_p,  # pindexid : JET_INDEXID* optional
    wintypes.DWORD,  # grbit : DWORD
    wintypes.DWORD,  # itagSequence : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetSetCurrentIndex4A = esent.NewProc("JetSetCurrentIndex4A")
)

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