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

CloseIMsgSession

関数
IMessageのメッセージセッションを閉じる。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

void CloseIMsgSession(
    LPMSGSESS lpMsgSess
);

パラメーター

名前方向説明
lpMsgSessLPMSGSESSin閉じる対象のメッセージセッションハンドル。OpenIMsgSessionで取得したもの。

戻り値の型: void

各言語での呼び出し定義

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

void CloseIMsgSession(
    LPMSGSESS lpMsgSess
);
[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern void CloseIMsgSession(
    IntPtr lpMsgSess   // LPMSGSESS
);
<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Sub CloseIMsgSession(
    lpMsgSess As IntPtr   ' LPMSGSESS
)
End Sub
' lpMsgSess : LPMSGSESS
Declare PtrSafe Sub CloseIMsgSession Lib "mapi32" ( _
    ByVal lpMsgSess As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CloseIMsgSession = ctypes.windll.mapi32.CloseIMsgSession
CloseIMsgSession.restype = None
CloseIMsgSession.argtypes = [
    ctypes.c_ssize_t,  # lpMsgSess : LPMSGSESS
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAPI32.dll')
CloseIMsgSession = Fiddle::Function.new(
  lib['CloseIMsgSession'],
  [
    Fiddle::TYPE_INTPTR_T,  # lpMsgSess : LPMSGSESS
  ],
  Fiddle::TYPE_VOID)
#[link(name = "mapi32")]
extern "system" {
    fn CloseIMsgSession(
        lpMsgSess: isize  // LPMSGSESS
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MAPI32.dll")]
public static extern void CloseIMsgSession(IntPtr lpMsgSess);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_CloseIMsgSession' -Namespace Win32 -PassThru
# $api::CloseIMsgSession(lpMsgSess)
#uselib "MAPI32.dll"
#func global CloseIMsgSession "CloseIMsgSession" sptr
; CloseIMsgSession lpMsgSess
; lpMsgSess : LPMSGSESS -> "sptr"
#uselib "MAPI32.dll"
#func global CloseIMsgSession "CloseIMsgSession" sptr
; CloseIMsgSession lpMsgSess
; lpMsgSess : LPMSGSESS -> "sptr"
; void CloseIMsgSession(LPMSGSESS lpMsgSess)
#uselib "MAPI32.dll"
#func global CloseIMsgSession "CloseIMsgSession" intptr
; CloseIMsgSession lpMsgSess
; lpMsgSess : LPMSGSESS -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procCloseIMsgSession = mapi32.NewProc("CloseIMsgSession")
)

// lpMsgSess (LPMSGSESS)
r1, _, err := procCloseIMsgSession.Call(
	uintptr(lpMsgSess),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure CloseIMsgSession(
  lpMsgSess: NativeInt   // LPMSGSESS
); stdcall;
  external 'MAPI32.dll' name 'CloseIMsgSession';
result := DllCall("MAPI32\CloseIMsgSession"
    , "Ptr", lpMsgSess   ; LPMSGSESS
    , "Int")   ; return: void
●CloseIMsgSession(lpMsgSess) = DLL("MAPI32.dll", "int CloseIMsgSession(int)")
# 呼び出し: CloseIMsgSession(lpMsgSess)
# lpMsgSess : LPMSGSESS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "mapi32" fn CloseIMsgSession(
    lpMsgSess: isize // LPMSGSESS
) callconv(std.os.windows.WINAPI) void;
proc CloseIMsgSession(
    lpMsgSess: int  # LPMSGSESS
) {.importc: "CloseIMsgSession", stdcall, dynlib: "MAPI32.dll".}
pragma(lib, "mapi32");
extern(Windows)
void CloseIMsgSession(
    ptrdiff_t lpMsgSess   // LPMSGSESS
);
ccall((:CloseIMsgSession, "MAPI32.dll"), stdcall, Cvoid,
      (Int,),
      lpMsgSess)
# lpMsgSess : LPMSGSESS -> Int
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void CloseIMsgSession(
    intptr_t lpMsgSess);
]]
local mapi32 = ffi.load("mapi32")
-- mapi32.CloseIMsgSession(lpMsgSess)
-- lpMsgSess : LPMSGSESS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MAPI32.dll');
const CloseIMsgSession = lib.func('__stdcall', 'CloseIMsgSession', 'void', ['intptr_t']);
// CloseIMsgSession(lpMsgSess)
// lpMsgSess : LPMSGSESS -> 'intptr_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MAPI32.dll", {
  CloseIMsgSession: { parameters: ["isize"], result: "void" },
});
// lib.symbols.CloseIMsgSession(lpMsgSess)
// lpMsgSess : LPMSGSESS -> "isize"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void CloseIMsgSession(
    intptr_t lpMsgSess);
C, "MAPI32.dll");
// $ffi->CloseIMsgSession(lpMsgSess);
// lpMsgSess : LPMSGSESS
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Mapi32 extends StdCallLibrary {
    Mapi32 INSTANCE = Native.load("mapi32", Mapi32.class);
    void CloseIMsgSession(
        long lpMsgSess   // LPMSGSESS
    );
}
@[Link("mapi32")]
lib LibMAPI32
  fun CloseIMsgSession = CloseIMsgSession(
    lpMsgSess : LibC::SSizeT   # LPMSGSESS
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CloseIMsgSessionNative = Void Function(IntPtr);
typedef CloseIMsgSessionDart = void Function(int);
final CloseIMsgSession = DynamicLibrary.open('MAPI32.dll')
    .lookupFunction<CloseIMsgSessionNative, CloseIMsgSessionDart>('CloseIMsgSession');
// lpMsgSess : LPMSGSESS -> IntPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure CloseIMsgSession(
  lpMsgSess: NativeInt   // LPMSGSESS
); stdcall;
  external 'MAPI32.dll' name 'CloseIMsgSession';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CloseIMsgSession"
  c_CloseIMsgSession :: CIntPtr -> IO ()
-- lpMsgSess : LPMSGSESS -> CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let closeimsgsession =
  foreign "CloseIMsgSession"
    (intptr_t @-> returning void)
(* lpMsgSess : LPMSGSESS -> intptr_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mapi32 (t "MAPI32.dll"))
(cffi:use-foreign-library mapi32)

(cffi:defcfun ("CloseIMsgSession" close-imsg-session :convention :stdcall) :void
  (lp-msg-sess :int64))   ; LPMSGSESS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CloseIMsgSession = Win32::API::More->new('MAPI32',
    'void CloseIMsgSession(LPARAM lpMsgSess)');
# my $ret = $CloseIMsgSession->Call($lpMsgSess);
# lpMsgSess : LPMSGSESS -> LPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。