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

JetDupCursor

関数
既存のカーソルを複製して新しいカーソルを作成する。
DLLESENT.dll呼出規約winapi

シグネチャ

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

INT JetDupCursor(
    JET_SESID sesid,
    JET_TABLEID tableid,
    JET_TABLEID* ptableid,
    DWORD grbit
);

パラメーター

名前方向
sesidJET_SESIDin
tableidJET_TABLEIDin
ptableidJET_TABLEID*out
grbitDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('ESENT.dll')
JetDupCursor = Fiddle::Function.new(
  lib['JetDupCursor'],
  [
    Fiddle::TYPE_UINTPTR_T,  # sesid : JET_SESID
    Fiddle::TYPE_UINTPTR_T,  # tableid : JET_TABLEID
    Fiddle::TYPE_VOIDP,  # ptableid : JET_TABLEID* out
    -Fiddle::TYPE_INT,  # grbit : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "esent")]
extern "system" {
    fn JetDupCursor(
        sesid: usize,  // JET_SESID
        tableid: usize,  // JET_TABLEID
        ptableid: *mut usize,  // JET_TABLEID* out
        grbit: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ESENT.dll")]
public static extern int JetDupCursor(UIntPtr sesid, UIntPtr tableid, out UIntPtr ptableid, uint grbit);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ESENT_JetDupCursor' -Namespace Win32 -PassThru
# $api::JetDupCursor(sesid, tableid, ptableid, grbit)
#uselib "ESENT.dll"
#func global JetDupCursor "JetDupCursor" sptr, sptr, sptr, sptr
; JetDupCursor sesid, tableid, ptableid, grbit   ; 戻り値は stat
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; ptableid : JET_TABLEID* out -> "sptr"
; grbit : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ESENT.dll"
#cfunc global JetDupCursor "JetDupCursor" sptr, sptr, int, int
; res = JetDupCursor(sesid, tableid, ptableid, grbit)
; sesid : JET_SESID -> "sptr"
; tableid : JET_TABLEID -> "sptr"
; ptableid : JET_TABLEID* out -> "int"
; grbit : DWORD -> "int"
; INT JetDupCursor(JET_SESID sesid, JET_TABLEID tableid, JET_TABLEID* ptableid, DWORD grbit)
#uselib "ESENT.dll"
#cfunc global JetDupCursor "JetDupCursor" intptr, intptr, int, int
; res = JetDupCursor(sesid, tableid, ptableid, grbit)
; sesid : JET_SESID -> "intptr"
; tableid : JET_TABLEID -> "intptr"
; ptableid : JET_TABLEID* out -> "int"
; grbit : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	esent = windows.NewLazySystemDLL("ESENT.dll")
	procJetDupCursor = esent.NewProc("JetDupCursor")
)

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