ホーム › Storage.Imapi › OpenIMsgOnIStg
OpenIMsgOnIStg
関数IStorage上にIMessageオブジェクトを開く。
シグネチャ
// MAPI32.dll
#include <windows.h>
INT OpenIMsgOnIStg(
LPMSGSESS lpMsgSess,
LPALLOCATEBUFFER lpAllocateBuffer,
LPALLOCATEMORE lpAllocateMore,
LPFREEBUFFER lpFreeBuffer,
IMalloc* lpMalloc,
void* lpMapiSup,
IStorage* lpStg,
MSGCALLRELEASE* lpfMsgCallRelease,
DWORD ulCallerData,
DWORD ulFlags,
IMessage** lppMsg
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpMsgSess | LPMSGSESS | in | メッセージが属するセッションのハンドル。NULL可。 |
| lpAllocateBuffer | LPALLOCATEBUFFER | in | MAPIメモリ確保関数LPALLOCATEBUFFERへのポインタ。 |
| lpAllocateMore | LPALLOCATEMORE | in | 既存割当に追加確保するLPALLOCATEMORE関数へのポインタ。 |
| lpFreeBuffer | LPFREEBUFFER | in | MAPIメモリ解放関数LPFREEBUFFERへのポインタ。 |
| lpMalloc | IMalloc* | in | メモリ確保に用いるIMallocインターフェイスへのポインタ。 |
| lpMapiSup | void* | inout | MAPIサポートオブジェクトへのポインタ。NULL可。 |
| lpStg | IStorage* | in | メッセージの基盤となるIStorageオブジェクトへのポインタ。 |
| lpfMsgCallRelease | MSGCALLRELEASE* | inout | 解放時に呼ばれるコールバック関数へのポインタ。NULL可。 |
| ulCallerData | DWORD | in | コールバックへ渡す呼び出し側のデータ値。 |
| ulFlags | DWORD | in | オープン動作を制御するフラグ。書き込み許可などを指定する。 |
| lppMsg | IMessage** | out | 生成されたIMessageインターフェイスを受け取るポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
INT OpenIMsgOnIStg(
LPMSGSESS lpMsgSess,
LPALLOCATEBUFFER lpAllocateBuffer,
LPALLOCATEMORE lpAllocateMore,
LPFREEBUFFER lpFreeBuffer,
IMalloc* lpMalloc,
void* lpMapiSup,
IStorage* lpStg,
MSGCALLRELEASE* lpfMsgCallRelease,
DWORD ulCallerData,
DWORD ulFlags,
IMessage** lppMsg
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int OpenIMsgOnIStg(
IntPtr lpMsgSess, // LPMSGSESS
IntPtr lpAllocateBuffer, // LPALLOCATEBUFFER
IntPtr lpAllocateMore, // LPALLOCATEMORE
IntPtr lpFreeBuffer, // LPFREEBUFFER
IntPtr lpMalloc, // IMalloc*
IntPtr lpMapiSup, // void* in/out
IntPtr lpStg, // IStorage*
IntPtr lpfMsgCallRelease, // MSGCALLRELEASE* in/out
uint ulCallerData, // DWORD
uint ulFlags, // DWORD
IntPtr lppMsg // IMessage** out
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function OpenIMsgOnIStg(
lpMsgSess As IntPtr, ' LPMSGSESS
lpAllocateBuffer As IntPtr, ' LPALLOCATEBUFFER
lpAllocateMore As IntPtr, ' LPALLOCATEMORE
lpFreeBuffer As IntPtr, ' LPFREEBUFFER
lpMalloc As IntPtr, ' IMalloc*
lpMapiSup As IntPtr, ' void* in/out
lpStg As IntPtr, ' IStorage*
lpfMsgCallRelease As IntPtr, ' MSGCALLRELEASE* in/out
ulCallerData As UInteger, ' DWORD
ulFlags As UInteger, ' DWORD
lppMsg As IntPtr ' IMessage** out
) As Integer
End Function' lpMsgSess : LPMSGSESS
' lpAllocateBuffer : LPALLOCATEBUFFER
' lpAllocateMore : LPALLOCATEMORE
' lpFreeBuffer : LPFREEBUFFER
' lpMalloc : IMalloc*
' lpMapiSup : void* in/out
' lpStg : IStorage*
' lpfMsgCallRelease : MSGCALLRELEASE* in/out
' ulCallerData : DWORD
' ulFlags : DWORD
' lppMsg : IMessage** out
Declare PtrSafe Function OpenIMsgOnIStg Lib "mapi32" ( _
ByVal lpMsgSess As LongPtr, _
ByVal lpAllocateBuffer As LongPtr, _
ByVal lpAllocateMore As LongPtr, _
ByVal lpFreeBuffer As LongPtr, _
ByVal lpMalloc As LongPtr, _
ByVal lpMapiSup As LongPtr, _
ByVal lpStg As LongPtr, _
ByVal lpfMsgCallRelease As LongPtr, _
ByVal ulCallerData As Long, _
ByVal ulFlags As Long, _
ByVal lppMsg As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OpenIMsgOnIStg = ctypes.windll.mapi32.OpenIMsgOnIStg
OpenIMsgOnIStg.restype = ctypes.c_int
OpenIMsgOnIStg.argtypes = [
ctypes.c_ssize_t, # lpMsgSess : LPMSGSESS
ctypes.c_void_p, # lpAllocateBuffer : LPALLOCATEBUFFER
ctypes.c_void_p, # lpAllocateMore : LPALLOCATEMORE
ctypes.c_void_p, # lpFreeBuffer : LPFREEBUFFER
ctypes.c_void_p, # lpMalloc : IMalloc*
ctypes.POINTER(None), # lpMapiSup : void* in/out
ctypes.c_void_p, # lpStg : IStorage*
ctypes.c_void_p, # lpfMsgCallRelease : MSGCALLRELEASE* in/out
wintypes.DWORD, # ulCallerData : DWORD
wintypes.DWORD, # ulFlags : DWORD
ctypes.c_void_p, # lppMsg : IMessage** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
OpenIMsgOnIStg = Fiddle::Function.new(
lib['OpenIMsgOnIStg'],
[
Fiddle::TYPE_INTPTR_T, # lpMsgSess : LPMSGSESS
Fiddle::TYPE_VOIDP, # lpAllocateBuffer : LPALLOCATEBUFFER
Fiddle::TYPE_VOIDP, # lpAllocateMore : LPALLOCATEMORE
Fiddle::TYPE_VOIDP, # lpFreeBuffer : LPFREEBUFFER
Fiddle::TYPE_VOIDP, # lpMalloc : IMalloc*
Fiddle::TYPE_VOIDP, # lpMapiSup : void* in/out
Fiddle::TYPE_VOIDP, # lpStg : IStorage*
Fiddle::TYPE_VOIDP, # lpfMsgCallRelease : MSGCALLRELEASE* in/out
-Fiddle::TYPE_INT, # ulCallerData : DWORD
-Fiddle::TYPE_INT, # ulFlags : DWORD
Fiddle::TYPE_VOIDP, # lppMsg : IMessage** out
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn OpenIMsgOnIStg(
lpMsgSess: isize, // LPMSGSESS
lpAllocateBuffer: *const core::ffi::c_void, // LPALLOCATEBUFFER
lpAllocateMore: *const core::ffi::c_void, // LPALLOCATEMORE
lpFreeBuffer: *const core::ffi::c_void, // LPFREEBUFFER
lpMalloc: *mut core::ffi::c_void, // IMalloc*
lpMapiSup: *mut (), // void* in/out
lpStg: *mut core::ffi::c_void, // IStorage*
lpfMsgCallRelease: *mut *const core::ffi::c_void, // MSGCALLRELEASE* in/out
ulCallerData: u32, // DWORD
ulFlags: u32, // DWORD
lppMsg: *mut *mut core::ffi::c_void // IMessage** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int OpenIMsgOnIStg(IntPtr lpMsgSess, IntPtr lpAllocateBuffer, IntPtr lpAllocateMore, IntPtr lpFreeBuffer, IntPtr lpMalloc, IntPtr lpMapiSup, IntPtr lpStg, IntPtr lpfMsgCallRelease, uint ulCallerData, uint ulFlags, IntPtr lppMsg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_OpenIMsgOnIStg' -Namespace Win32 -PassThru
# $api::OpenIMsgOnIStg(lpMsgSess, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpMalloc, lpMapiSup, lpStg, lpfMsgCallRelease, ulCallerData, ulFlags, lppMsg)#uselib "MAPI32.dll"
#func global OpenIMsgOnIStg "OpenIMsgOnIStg" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; OpenIMsgOnIStg lpMsgSess, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpMalloc, lpMapiSup, lpStg, lpfMsgCallRelease, ulCallerData, ulFlags, lppMsg ; 戻り値は stat
; lpMsgSess : LPMSGSESS -> "sptr"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lpAllocateMore : LPALLOCATEMORE -> "sptr"
; lpFreeBuffer : LPFREEBUFFER -> "sptr"
; lpMalloc : IMalloc* -> "sptr"
; lpMapiSup : void* in/out -> "sptr"
; lpStg : IStorage* -> "sptr"
; lpfMsgCallRelease : MSGCALLRELEASE* in/out -> "sptr"
; ulCallerData : DWORD -> "sptr"
; ulFlags : DWORD -> "sptr"
; lppMsg : IMessage** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MAPI32.dll"
#cfunc global OpenIMsgOnIStg "OpenIMsgOnIStg" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, int, int, sptr
; res = OpenIMsgOnIStg(lpMsgSess, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpMalloc, lpMapiSup, lpStg, lpfMsgCallRelease, ulCallerData, ulFlags, lppMsg)
; lpMsgSess : LPMSGSESS -> "sptr"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "sptr"
; lpAllocateMore : LPALLOCATEMORE -> "sptr"
; lpFreeBuffer : LPFREEBUFFER -> "sptr"
; lpMalloc : IMalloc* -> "sptr"
; lpMapiSup : void* in/out -> "sptr"
; lpStg : IStorage* -> "sptr"
; lpfMsgCallRelease : MSGCALLRELEASE* in/out -> "sptr"
; ulCallerData : DWORD -> "int"
; ulFlags : DWORD -> "int"
; lppMsg : IMessage** out -> "sptr"; INT OpenIMsgOnIStg(LPMSGSESS lpMsgSess, LPALLOCATEBUFFER lpAllocateBuffer, LPALLOCATEMORE lpAllocateMore, LPFREEBUFFER lpFreeBuffer, IMalloc* lpMalloc, void* lpMapiSup, IStorage* lpStg, MSGCALLRELEASE* lpfMsgCallRelease, DWORD ulCallerData, DWORD ulFlags, IMessage** lppMsg)
#uselib "MAPI32.dll"
#cfunc global OpenIMsgOnIStg "OpenIMsgOnIStg" intptr, intptr, intptr, intptr, intptr, intptr, intptr, intptr, int, int, intptr
; res = OpenIMsgOnIStg(lpMsgSess, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpMalloc, lpMapiSup, lpStg, lpfMsgCallRelease, ulCallerData, ulFlags, lppMsg)
; lpMsgSess : LPMSGSESS -> "intptr"
; lpAllocateBuffer : LPALLOCATEBUFFER -> "intptr"
; lpAllocateMore : LPALLOCATEMORE -> "intptr"
; lpFreeBuffer : LPFREEBUFFER -> "intptr"
; lpMalloc : IMalloc* -> "intptr"
; lpMapiSup : void* in/out -> "intptr"
; lpStg : IStorage* -> "intptr"
; lpfMsgCallRelease : MSGCALLRELEASE* in/out -> "intptr"
; ulCallerData : DWORD -> "int"
; ulFlags : DWORD -> "int"
; lppMsg : IMessage** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procOpenIMsgOnIStg = mapi32.NewProc("OpenIMsgOnIStg")
)
// lpMsgSess (LPMSGSESS), lpAllocateBuffer (LPALLOCATEBUFFER), lpAllocateMore (LPALLOCATEMORE), lpFreeBuffer (LPFREEBUFFER), lpMalloc (IMalloc*), lpMapiSup (void* in/out), lpStg (IStorage*), lpfMsgCallRelease (MSGCALLRELEASE* in/out), ulCallerData (DWORD), ulFlags (DWORD), lppMsg (IMessage** out)
r1, _, err := procOpenIMsgOnIStg.Call(
uintptr(lpMsgSess),
uintptr(lpAllocateBuffer),
uintptr(lpAllocateMore),
uintptr(lpFreeBuffer),
uintptr(lpMalloc),
uintptr(lpMapiSup),
uintptr(lpStg),
uintptr(lpfMsgCallRelease),
uintptr(ulCallerData),
uintptr(ulFlags),
uintptr(lppMsg),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction OpenIMsgOnIStg(
lpMsgSess: NativeInt; // LPMSGSESS
lpAllocateBuffer: Pointer; // LPALLOCATEBUFFER
lpAllocateMore: Pointer; // LPALLOCATEMORE
lpFreeBuffer: Pointer; // LPFREEBUFFER
lpMalloc: Pointer; // IMalloc*
lpMapiSup: Pointer; // void* in/out
lpStg: Pointer; // IStorage*
lpfMsgCallRelease: Pointer; // MSGCALLRELEASE* in/out
ulCallerData: DWORD; // DWORD
ulFlags: DWORD; // DWORD
lppMsg: Pointer // IMessage** out
): Integer; stdcall;
external 'MAPI32.dll' name 'OpenIMsgOnIStg';result := DllCall("MAPI32\OpenIMsgOnIStg"
, "Ptr", lpMsgSess ; LPMSGSESS
, "Ptr", lpAllocateBuffer ; LPALLOCATEBUFFER
, "Ptr", lpAllocateMore ; LPALLOCATEMORE
, "Ptr", lpFreeBuffer ; LPFREEBUFFER
, "Ptr", lpMalloc ; IMalloc*
, "Ptr", lpMapiSup ; void* in/out
, "Ptr", lpStg ; IStorage*
, "Ptr", lpfMsgCallRelease ; MSGCALLRELEASE* in/out
, "UInt", ulCallerData ; DWORD
, "UInt", ulFlags ; DWORD
, "Ptr", lppMsg ; IMessage** out
, "Int") ; return: INT●OpenIMsgOnIStg(lpMsgSess, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpMalloc, lpMapiSup, lpStg, lpfMsgCallRelease, ulCallerData, ulFlags, lppMsg) = DLL("MAPI32.dll", "int OpenIMsgOnIStg(int, void*, void*, void*, void*, void*, void*, void*, dword, dword, void*)")
# 呼び出し: OpenIMsgOnIStg(lpMsgSess, lpAllocateBuffer, lpAllocateMore, lpFreeBuffer, lpMalloc, lpMapiSup, lpStg, lpfMsgCallRelease, ulCallerData, ulFlags, lppMsg)
# lpMsgSess : LPMSGSESS -> "int"
# lpAllocateBuffer : LPALLOCATEBUFFER -> "void*"
# lpAllocateMore : LPALLOCATEMORE -> "void*"
# lpFreeBuffer : LPFREEBUFFER -> "void*"
# lpMalloc : IMalloc* -> "void*"
# lpMapiSup : void* in/out -> "void*"
# lpStg : IStorage* -> "void*"
# lpfMsgCallRelease : MSGCALLRELEASE* in/out -> "void*"
# ulCallerData : DWORD -> "dword"
# ulFlags : DWORD -> "dword"
# lppMsg : IMessage** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。