ホーム › Storage.Imapi › OpenIMsgSession
OpenIMsgSession
関数IMessage操作用のメッセージセッションを開く。
シグネチャ
// MAPI32.dll
#include <windows.h>
INT OpenIMsgSession(
IMalloc* lpMalloc,
DWORD ulFlags,
LPMSGSESS* lppMsgSess
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpMalloc | IMalloc* | in | メモリ確保に用いるIMallocインターフェイスへのポインタ。 |
| ulFlags | DWORD | in | セッション動作を制御するフラグ。通常は0を指定する。 |
| lppMsgSess | LPMSGSESS* | inout | 開かれたメッセージセッションのハンドルを受け取るLPMSGSESSへのポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
INT OpenIMsgSession(
IMalloc* lpMalloc,
DWORD ulFlags,
LPMSGSESS* lppMsgSess
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int OpenIMsgSession(
IntPtr lpMalloc, // IMalloc*
uint ulFlags, // DWORD
ref IntPtr lppMsgSess // LPMSGSESS* in/out
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function OpenIMsgSession(
lpMalloc As IntPtr, ' IMalloc*
ulFlags As UInteger, ' DWORD
ByRef lppMsgSess As IntPtr ' LPMSGSESS* in/out
) As Integer
End Function' lpMalloc : IMalloc*
' ulFlags : DWORD
' lppMsgSess : LPMSGSESS* in/out
Declare PtrSafe Function OpenIMsgSession Lib "mapi32" ( _
ByVal lpMalloc As LongPtr, _
ByVal ulFlags As Long, _
ByRef lppMsgSess As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OpenIMsgSession = ctypes.windll.mapi32.OpenIMsgSession
OpenIMsgSession.restype = ctypes.c_int
OpenIMsgSession.argtypes = [
ctypes.c_void_p, # lpMalloc : IMalloc*
wintypes.DWORD, # ulFlags : DWORD
ctypes.c_void_p, # lppMsgSess : LPMSGSESS* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
OpenIMsgSession = Fiddle::Function.new(
lib['OpenIMsgSession'],
[
Fiddle::TYPE_VOIDP, # lpMalloc : IMalloc*
-Fiddle::TYPE_INT, # ulFlags : DWORD
Fiddle::TYPE_VOIDP, # lppMsgSess : LPMSGSESS* in/out
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn OpenIMsgSession(
lpMalloc: *mut core::ffi::c_void, // IMalloc*
ulFlags: u32, // DWORD
lppMsgSess: *mut isize // LPMSGSESS* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int OpenIMsgSession(IntPtr lpMalloc, uint ulFlags, ref IntPtr lppMsgSess);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_OpenIMsgSession' -Namespace Win32 -PassThru
# $api::OpenIMsgSession(lpMalloc, ulFlags, lppMsgSess)#uselib "MAPI32.dll"
#func global OpenIMsgSession "OpenIMsgSession" sptr, sptr, sptr
; OpenIMsgSession lpMalloc, ulFlags, lppMsgSess ; 戻り値は stat
; lpMalloc : IMalloc* -> "sptr"
; ulFlags : DWORD -> "sptr"
; lppMsgSess : LPMSGSESS* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MAPI32.dll"
#cfunc global OpenIMsgSession "OpenIMsgSession" sptr, int, int
; res = OpenIMsgSession(lpMalloc, ulFlags, lppMsgSess)
; lpMalloc : IMalloc* -> "sptr"
; ulFlags : DWORD -> "int"
; lppMsgSess : LPMSGSESS* in/out -> "int"; INT OpenIMsgSession(IMalloc* lpMalloc, DWORD ulFlags, LPMSGSESS* lppMsgSess)
#uselib "MAPI32.dll"
#cfunc global OpenIMsgSession "OpenIMsgSession" intptr, int, int
; res = OpenIMsgSession(lpMalloc, ulFlags, lppMsgSess)
; lpMalloc : IMalloc* -> "intptr"
; ulFlags : DWORD -> "int"
; lppMsgSess : LPMSGSESS* in/out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procOpenIMsgSession = mapi32.NewProc("OpenIMsgSession")
)
// lpMalloc (IMalloc*), ulFlags (DWORD), lppMsgSess (LPMSGSESS* in/out)
r1, _, err := procOpenIMsgSession.Call(
uintptr(lpMalloc),
uintptr(ulFlags),
uintptr(lppMsgSess),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction OpenIMsgSession(
lpMalloc: Pointer; // IMalloc*
ulFlags: DWORD; // DWORD
lppMsgSess: Pointer // LPMSGSESS* in/out
): Integer; stdcall;
external 'MAPI32.dll' name 'OpenIMsgSession';result := DllCall("MAPI32\OpenIMsgSession"
, "Ptr", lpMalloc ; IMalloc*
, "UInt", ulFlags ; DWORD
, "Ptr", lppMsgSess ; LPMSGSESS* in/out
, "Int") ; return: INT●OpenIMsgSession(lpMalloc, ulFlags, lppMsgSess) = DLL("MAPI32.dll", "int OpenIMsgSession(void*, dword, void*)")
# 呼び出し: OpenIMsgSession(lpMalloc, ulFlags, lppMsgSess)
# lpMalloc : IMalloc* -> "void*"
# ulFlags : DWORD -> "dword"
# lppMsgSess : LPMSGSESS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。