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

CreateTable

関数
MAPIのインメモリテーブルデータオブジェクトを作成する。
DLLrtm.dll呼出規約winapi

シグネチャ

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

INT CreateTable(
    GUID* lpInterface,
    LPALLOCATEBUFFER lpAllocateBuffer,
    LPALLOCATEMORE lpAllocateMore,
    LPFREEBUFFER lpFreeBuffer,
    void* lpvReserved,
    DWORD ulTableType,
    DWORD ulPropTagIndexColumn,
    SPropTagArray* lpSPropTagArrayColumns,
    ITableData** lppTableData
);

パラメーター

名前方向
lpInterfaceGUID*inout
lpAllocateBufferLPALLOCATEBUFFERin
lpAllocateMoreLPALLOCATEMOREin
lpFreeBufferLPFREEBUFFERin
lpvReservedvoid*inout
ulTableTypeDWORDin
ulPropTagIndexColumnDWORDin
lpSPropTagArrayColumnsSPropTagArray*inout
lppTableDataITableData**out

戻り値の型: INT

各言語での呼び出し定義

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

INT CreateTable(
    GUID* lpInterface,
    LPALLOCATEBUFFER lpAllocateBuffer,
    LPALLOCATEMORE lpAllocateMore,
    LPFREEBUFFER lpFreeBuffer,
    void* lpvReserved,
    DWORD ulTableType,
    DWORD ulPropTagIndexColumn,
    SPropTagArray* lpSPropTagArrayColumns,
    ITableData** lppTableData
);
[DllImport("rtm.dll", ExactSpelling = true)]
static extern int CreateTable(
    ref Guid lpInterface,   // GUID* in/out
    IntPtr lpAllocateBuffer,   // LPALLOCATEBUFFER
    IntPtr lpAllocateMore,   // LPALLOCATEMORE
    IntPtr lpFreeBuffer,   // LPFREEBUFFER
    IntPtr lpvReserved,   // void* in/out
    uint ulTableType,   // DWORD
    uint ulPropTagIndexColumn,   // DWORD
    IntPtr lpSPropTagArrayColumns,   // SPropTagArray* in/out
    IntPtr lppTableData   // ITableData** out
);
<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function CreateTable(
    ByRef lpInterface As Guid,   ' GUID* in/out
    lpAllocateBuffer As IntPtr,   ' LPALLOCATEBUFFER
    lpAllocateMore As IntPtr,   ' LPALLOCATEMORE
    lpFreeBuffer As IntPtr,   ' LPFREEBUFFER
    lpvReserved As IntPtr,   ' void* in/out
    ulTableType As UInteger,   ' DWORD
    ulPropTagIndexColumn As UInteger,   ' DWORD
    lpSPropTagArrayColumns As IntPtr,   ' SPropTagArray* in/out
    lppTableData As IntPtr   ' ITableData** out
) As Integer
End Function
' lpInterface : GUID* in/out
' lpAllocateBuffer : LPALLOCATEBUFFER
' lpAllocateMore : LPALLOCATEMORE
' lpFreeBuffer : LPFREEBUFFER
' lpvReserved : void* in/out
' ulTableType : DWORD
' ulPropTagIndexColumn : DWORD
' lpSPropTagArrayColumns : SPropTagArray* in/out
' lppTableData : ITableData** out
Declare PtrSafe Function CreateTable Lib "rtm" ( _
    ByVal lpInterface As LongPtr, _
    ByVal lpAllocateBuffer As LongPtr, _
    ByVal lpAllocateMore As LongPtr, _
    ByVal lpFreeBuffer As LongPtr, _
    ByVal lpvReserved As LongPtr, _
    ByVal ulTableType As Long, _
    ByVal ulPropTagIndexColumn As Long, _
    ByVal lpSPropTagArrayColumns As LongPtr, _
    ByVal lppTableData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreateTable = ctypes.windll.rtm.CreateTable
CreateTable.restype = ctypes.c_int
CreateTable.argtypes = [
    ctypes.c_void_p,  # lpInterface : GUID* in/out
    ctypes.c_void_p,  # lpAllocateBuffer : LPALLOCATEBUFFER
    ctypes.c_void_p,  # lpAllocateMore : LPALLOCATEMORE
    ctypes.c_void_p,  # lpFreeBuffer : LPFREEBUFFER
    ctypes.POINTER(None),  # lpvReserved : void* in/out
    wintypes.DWORD,  # ulTableType : DWORD
    wintypes.DWORD,  # ulPropTagIndexColumn : DWORD
    ctypes.c_void_p,  # lpSPropTagArrayColumns : SPropTagArray* in/out
    ctypes.c_void_p,  # lppTableData : ITableData** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('rtm.dll')
CreateTable = Fiddle::Function.new(
  lib['CreateTable'],
  [
    Fiddle::TYPE_VOIDP,  # lpInterface : GUID* in/out
    Fiddle::TYPE_VOIDP,  # lpAllocateBuffer : LPALLOCATEBUFFER
    Fiddle::TYPE_VOIDP,  # lpAllocateMore : LPALLOCATEMORE
    Fiddle::TYPE_VOIDP,  # lpFreeBuffer : LPFREEBUFFER
    Fiddle::TYPE_VOIDP,  # lpvReserved : void* in/out
    -Fiddle::TYPE_INT,  # ulTableType : DWORD
    -Fiddle::TYPE_INT,  # ulPropTagIndexColumn : DWORD
    Fiddle::TYPE_VOIDP,  # lpSPropTagArrayColumns : SPropTagArray* in/out
    Fiddle::TYPE_VOIDP,  # lppTableData : ITableData** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "rtm")]
extern "system" {
    fn CreateTable(
        lpInterface: *mut GUID,  // GUID* in/out
        lpAllocateBuffer: *const core::ffi::c_void,  // LPALLOCATEBUFFER
        lpAllocateMore: *const core::ffi::c_void,  // LPALLOCATEMORE
        lpFreeBuffer: *const core::ffi::c_void,  // LPFREEBUFFER
        lpvReserved: *mut (),  // void* in/out
        ulTableType: u32,  // DWORD
        ulPropTagIndexColumn: u32,  // DWORD
        lpSPropTagArrayColumns: *mut SPropTagArray,  // SPropTagArray* in/out
        lppTableData: *mut *mut core::ffi::c_void  // ITableData** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("rtm.dll")]
public static extern int CreateTable(ref Guid lpInterface, IntPtr lpAllocateBuffer, IntPtr lpAllocateMore, IntPtr lpFreeBuffer, IntPtr lpvReserved, uint ulTableType, uint ulPropTagIndexColumn, IntPtr lpSPropTagArrayColumns, IntPtr lppTableData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtm_CreateTable' -Namespace Win32 -PassThru
# $api::CreateTable(lpInterface, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpvReserved, ulTableType, ulPropTagIndexColumn, lpSPropTagArrayColumns, lppTableData)
#uselib "rtm.dll"
#func global CreateTable "CreateTable" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CreateTable varptr(lpInterface), lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpvReserved, ulTableType, ulPropTagIndexColumn, varptr(lpSPropTagArrayColumns), lppTableData   ; 戻り値は stat
; lpInterface : GUID* in/out -> "sptr"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lpAllocateMore : LPALLOCATEMORE -> "sptr"
; lpFreeBuffer : LPFREEBUFFER -> "sptr"
; lpvReserved : void* in/out -> "sptr"
; ulTableType : DWORD -> "sptr"
; ulPropTagIndexColumn : DWORD -> "sptr"
; lpSPropTagArrayColumns : SPropTagArray* in/out -> "sptr"
; lppTableData : ITableData** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "rtm.dll"
#cfunc global CreateTable "CreateTable" var, sptr, sptr, sptr, sptr, int, int, var, sptr
; res = CreateTable(lpInterface, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpvReserved, ulTableType, ulPropTagIndexColumn, lpSPropTagArrayColumns, lppTableData)
; lpInterface : GUID* in/out -> "var"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lpAllocateMore : LPALLOCATEMORE -> "sptr"
; lpFreeBuffer : LPFREEBUFFER -> "sptr"
; lpvReserved : void* in/out -> "sptr"
; ulTableType : DWORD -> "int"
; ulPropTagIndexColumn : DWORD -> "int"
; lpSPropTagArrayColumns : SPropTagArray* in/out -> "var"
; lppTableData : ITableData** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT CreateTable(GUID* lpInterface, LPALLOCATEBUFFER lpAllocateBuffer, LPALLOCATEMORE lpAllocateMore, LPFREEBUFFER lpFreeBuffer, void* lpvReserved, DWORD ulTableType, DWORD ulPropTagIndexColumn, SPropTagArray* lpSPropTagArrayColumns, ITableData** lppTableData)
#uselib "rtm.dll"
#cfunc global CreateTable "CreateTable" var, intptr, intptr, intptr, intptr, int, int, var, intptr
; res = CreateTable(lpInterface, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpvReserved, ulTableType, ulPropTagIndexColumn, lpSPropTagArrayColumns, lppTableData)
; lpInterface : GUID* in/out -> "var"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "intptr"
; lpAllocateMore : LPALLOCATEMORE -> "intptr"
; lpFreeBuffer : LPFREEBUFFER -> "intptr"
; lpvReserved : void* in/out -> "intptr"
; ulTableType : DWORD -> "int"
; ulPropTagIndexColumn : DWORD -> "int"
; lpSPropTagArrayColumns : SPropTagArray* in/out -> "var"
; lppTableData : ITableData** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procCreateTable = rtm.NewProc("CreateTable")
)

// lpInterface (GUID* in/out), lpAllocateBuffer (LPALLOCATEBUFFER), lpAllocateMore (LPALLOCATEMORE), lpFreeBuffer (LPFREEBUFFER), lpvReserved (void* in/out), ulTableType (DWORD), ulPropTagIndexColumn (DWORD), lpSPropTagArrayColumns (SPropTagArray* in/out), lppTableData (ITableData** out)
r1, _, err := procCreateTable.Call(
	uintptr(lpInterface),
	uintptr(lpAllocateBuffer),
	uintptr(lpAllocateMore),
	uintptr(lpFreeBuffer),
	uintptr(lpvReserved),
	uintptr(ulTableType),
	uintptr(ulPropTagIndexColumn),
	uintptr(lpSPropTagArrayColumns),
	uintptr(lppTableData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function CreateTable(
  lpInterface: PGUID;   // GUID* in/out
  lpAllocateBuffer: Pointer;   // LPALLOCATEBUFFER
  lpAllocateMore: Pointer;   // LPALLOCATEMORE
  lpFreeBuffer: Pointer;   // LPFREEBUFFER
  lpvReserved: Pointer;   // void* in/out
  ulTableType: DWORD;   // DWORD
  ulPropTagIndexColumn: DWORD;   // DWORD
  lpSPropTagArrayColumns: Pointer;   // SPropTagArray* in/out
  lppTableData: Pointer   // ITableData** out
): Integer; stdcall;
  external 'rtm.dll' name 'CreateTable';
result := DllCall("rtm\CreateTable"
    , "Ptr", lpInterface   ; GUID* in/out
    , "Ptr", lpAllocateBuffer   ; LPALLOCATEBUFFER
    , "Ptr", lpAllocateMore   ; LPALLOCATEMORE
    , "Ptr", lpFreeBuffer   ; LPFREEBUFFER
    , "Ptr", lpvReserved   ; void* in/out
    , "UInt", ulTableType   ; DWORD
    , "UInt", ulPropTagIndexColumn   ; DWORD
    , "Ptr", lpSPropTagArrayColumns   ; SPropTagArray* in/out
    , "Ptr", lppTableData   ; ITableData** out
    , "Int")   ; return: INT
●CreateTable(lpInterface, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpvReserved, ulTableType, ulPropTagIndexColumn, lpSPropTagArrayColumns, lppTableData) = DLL("rtm.dll", "int CreateTable(void*, void*, void*, void*, void*, dword, dword, void*, void*)")
# 呼び出し: CreateTable(lpInterface, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpvReserved, ulTableType, ulPropTagIndexColumn, lpSPropTagArrayColumns, lppTableData)
# lpInterface : GUID* in/out -> "void*"
# lpAllocateBuffer : LPALLOCATEBUFFER -> "void*"
# lpAllocateMore : LPALLOCATEMORE -> "void*"
# lpFreeBuffer : LPFREEBUFFER -> "void*"
# lpvReserved : void* in/out -> "void*"
# ulTableType : DWORD -> "dword"
# ulPropTagIndexColumn : DWORD -> "dword"
# lpSPropTagArrayColumns : SPropTagArray* in/out -> "void*"
# lppTableData : ITableData** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。