ホーム › System.AddressBook › HrAddColumns
HrAddColumns
関数MAPIテーブルへ新しい列(プロパティ)を追加する。
シグネチャ
// MAPI32.dll
#include <windows.h>
HRESULT HrAddColumns(
IMAPITable* lptbl,
SPropTagArray* lpproptagColumnsNew,
LPALLOCATEBUFFER lpAllocateBuffer,
LPFREEBUFFER lpFreeBuffer
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lptbl | IMAPITable* | in |
| lpproptagColumnsNew | SPropTagArray* | inout |
| lpAllocateBuffer | LPALLOCATEBUFFER | in |
| lpFreeBuffer | LPFREEBUFFER | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
HRESULT HrAddColumns(
IMAPITable* lptbl,
SPropTagArray* lpproptagColumnsNew,
LPALLOCATEBUFFER lpAllocateBuffer,
LPFREEBUFFER lpFreeBuffer
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int HrAddColumns(
IntPtr lptbl, // IMAPITable*
IntPtr lpproptagColumnsNew, // SPropTagArray* in/out
IntPtr lpAllocateBuffer, // LPALLOCATEBUFFER
IntPtr lpFreeBuffer // LPFREEBUFFER
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function HrAddColumns(
lptbl As IntPtr, ' IMAPITable*
lpproptagColumnsNew As IntPtr, ' SPropTagArray* in/out
lpAllocateBuffer As IntPtr, ' LPALLOCATEBUFFER
lpFreeBuffer As IntPtr ' LPFREEBUFFER
) As Integer
End Function' lptbl : IMAPITable*
' lpproptagColumnsNew : SPropTagArray* in/out
' lpAllocateBuffer : LPALLOCATEBUFFER
' lpFreeBuffer : LPFREEBUFFER
Declare PtrSafe Function HrAddColumns Lib "mapi32" ( _
ByVal lptbl As LongPtr, _
ByVal lpproptagColumnsNew As LongPtr, _
ByVal lpAllocateBuffer As LongPtr, _
ByVal lpFreeBuffer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HrAddColumns = ctypes.windll.mapi32.HrAddColumns
HrAddColumns.restype = ctypes.c_int
HrAddColumns.argtypes = [
ctypes.c_void_p, # lptbl : IMAPITable*
ctypes.c_void_p, # lpproptagColumnsNew : SPropTagArray* in/out
ctypes.c_void_p, # lpAllocateBuffer : LPALLOCATEBUFFER
ctypes.c_void_p, # lpFreeBuffer : LPFREEBUFFER
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
HrAddColumns = Fiddle::Function.new(
lib['HrAddColumns'],
[
Fiddle::TYPE_VOIDP, # lptbl : IMAPITable*
Fiddle::TYPE_VOIDP, # lpproptagColumnsNew : SPropTagArray* in/out
Fiddle::TYPE_VOIDP, # lpAllocateBuffer : LPALLOCATEBUFFER
Fiddle::TYPE_VOIDP, # lpFreeBuffer : LPFREEBUFFER
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn HrAddColumns(
lptbl: *mut core::ffi::c_void, // IMAPITable*
lpproptagColumnsNew: *mut SPropTagArray, // SPropTagArray* in/out
lpAllocateBuffer: *const core::ffi::c_void, // LPALLOCATEBUFFER
lpFreeBuffer: *const core::ffi::c_void // LPFREEBUFFER
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int HrAddColumns(IntPtr lptbl, IntPtr lpproptagColumnsNew, IntPtr lpAllocateBuffer, IntPtr lpFreeBuffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_HrAddColumns' -Namespace Win32 -PassThru
# $api::HrAddColumns(lptbl, lpproptagColumnsNew, lpAllocateBuffer, lpFreeBuffer)#uselib "MAPI32.dll"
#func global HrAddColumns "HrAddColumns" sptr, sptr, sptr, sptr
; HrAddColumns lptbl, varptr(lpproptagColumnsNew), lpAllocateBuffer, lpFreeBuffer ; 戻り値は stat
; lptbl : IMAPITable* -> "sptr"
; lpproptagColumnsNew : SPropTagArray* in/out -> "sptr"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lpFreeBuffer : LPFREEBUFFER -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MAPI32.dll" #cfunc global HrAddColumns "HrAddColumns" sptr, var, sptr, sptr ; res = HrAddColumns(lptbl, lpproptagColumnsNew, lpAllocateBuffer, lpFreeBuffer) ; lptbl : IMAPITable* -> "sptr" ; lpproptagColumnsNew : SPropTagArray* in/out -> "var" ; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr" ; lpFreeBuffer : LPFREEBUFFER -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MAPI32.dll" #cfunc global HrAddColumns "HrAddColumns" sptr, sptr, sptr, sptr ; res = HrAddColumns(lptbl, varptr(lpproptagColumnsNew), lpAllocateBuffer, lpFreeBuffer) ; lptbl : IMAPITable* -> "sptr" ; lpproptagColumnsNew : SPropTagArray* in/out -> "sptr" ; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr" ; lpFreeBuffer : LPFREEBUFFER -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HrAddColumns(IMAPITable* lptbl, SPropTagArray* lpproptagColumnsNew, LPALLOCATEBUFFER lpAllocateBuffer, LPFREEBUFFER lpFreeBuffer) #uselib "MAPI32.dll" #cfunc global HrAddColumns "HrAddColumns" intptr, var, intptr, intptr ; res = HrAddColumns(lptbl, lpproptagColumnsNew, lpAllocateBuffer, lpFreeBuffer) ; lptbl : IMAPITable* -> "intptr" ; lpproptagColumnsNew : SPropTagArray* in/out -> "var" ; lpAllocateBuffer : LPALLOCATEBUFFER -> "intptr" ; lpFreeBuffer : LPFREEBUFFER -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HrAddColumns(IMAPITable* lptbl, SPropTagArray* lpproptagColumnsNew, LPALLOCATEBUFFER lpAllocateBuffer, LPFREEBUFFER lpFreeBuffer) #uselib "MAPI32.dll" #cfunc global HrAddColumns "HrAddColumns" intptr, intptr, intptr, intptr ; res = HrAddColumns(lptbl, varptr(lpproptagColumnsNew), lpAllocateBuffer, lpFreeBuffer) ; lptbl : IMAPITable* -> "intptr" ; lpproptagColumnsNew : SPropTagArray* in/out -> "intptr" ; lpAllocateBuffer : LPALLOCATEBUFFER -> "intptr" ; lpFreeBuffer : LPFREEBUFFER -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procHrAddColumns = mapi32.NewProc("HrAddColumns")
)
// lptbl (IMAPITable*), lpproptagColumnsNew (SPropTagArray* in/out), lpAllocateBuffer (LPALLOCATEBUFFER), lpFreeBuffer (LPFREEBUFFER)
r1, _, err := procHrAddColumns.Call(
uintptr(lptbl),
uintptr(lpproptagColumnsNew),
uintptr(lpAllocateBuffer),
uintptr(lpFreeBuffer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HrAddColumns(
lptbl: Pointer; // IMAPITable*
lpproptagColumnsNew: Pointer; // SPropTagArray* in/out
lpAllocateBuffer: Pointer; // LPALLOCATEBUFFER
lpFreeBuffer: Pointer // LPFREEBUFFER
): Integer; stdcall;
external 'MAPI32.dll' name 'HrAddColumns';result := DllCall("MAPI32\HrAddColumns"
, "Ptr", lptbl ; IMAPITable*
, "Ptr", lpproptagColumnsNew ; SPropTagArray* in/out
, "Ptr", lpAllocateBuffer ; LPALLOCATEBUFFER
, "Ptr", lpFreeBuffer ; LPFREEBUFFER
, "Int") ; return: HRESULT●HrAddColumns(lptbl, lpproptagColumnsNew, lpAllocateBuffer, lpFreeBuffer) = DLL("MAPI32.dll", "int HrAddColumns(void*, void*, void*, void*)")
# 呼び出し: HrAddColumns(lptbl, lpproptagColumnsNew, lpAllocateBuffer, lpFreeBuffer)
# lptbl : IMAPITable* -> "void*"
# lpproptagColumnsNew : SPropTagArray* in/out -> "void*"
# lpAllocateBuffer : LPALLOCATEBUFFER -> "void*"
# lpFreeBuffer : LPFREEBUFFER -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。