Win32 API 日本語リファレンス
ホームNetworkManagement.Snmp › SnmpMgrClose

SnmpMgrClose

関数
SNMPエージェントへの管理セッションを閉じる。
DLLmgmtapi.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL SnmpMgrClose(
    void* session
);

パラメーター

名前方向
sessionvoid*inout

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SnmpMgrClose(
    void* session
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mgmtapi.dll", ExactSpelling = true)]
static extern bool SnmpMgrClose(
    IntPtr session   // void* in/out
);
<DllImport("mgmtapi.dll", ExactSpelling:=True)>
Public Shared Function SnmpMgrClose(
    session As IntPtr   ' void* in/out
) As Boolean
End Function
' session : void* in/out
Declare PtrSafe Function SnmpMgrClose Lib "mgmtapi" ( _
    ByVal session As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SnmpMgrClose = ctypes.windll.mgmtapi.SnmpMgrClose
SnmpMgrClose.restype = wintypes.BOOL
SnmpMgrClose.argtypes = [
    ctypes.POINTER(None),  # session : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mgmtapi.dll')
SnmpMgrClose = Fiddle::Function.new(
  lib['SnmpMgrClose'],
  [
    Fiddle::TYPE_VOIDP,  # session : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mgmtapi")]
extern "system" {
    fn SnmpMgrClose(
        session: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mgmtapi.dll")]
public static extern bool SnmpMgrClose(IntPtr session);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mgmtapi_SnmpMgrClose' -Namespace Win32 -PassThru
# $api::SnmpMgrClose(session)
#uselib "mgmtapi.dll"
#func global SnmpMgrClose "SnmpMgrClose" sptr
; SnmpMgrClose session   ; 戻り値は stat
; session : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mgmtapi.dll"
#cfunc global SnmpMgrClose "SnmpMgrClose" sptr
; res = SnmpMgrClose(session)
; session : void* in/out -> "sptr"
; BOOL SnmpMgrClose(void* session)
#uselib "mgmtapi.dll"
#cfunc global SnmpMgrClose "SnmpMgrClose" intptr
; res = SnmpMgrClose(session)
; session : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mgmtapi = windows.NewLazySystemDLL("mgmtapi.dll")
	procSnmpMgrClose = mgmtapi.NewProc("SnmpMgrClose")
)

// session (void* in/out)
r1, _, err := procSnmpMgrClose.Call(
	uintptr(session),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SnmpMgrClose(
  session: Pointer   // void* in/out
): BOOL; stdcall;
  external 'mgmtapi.dll' name 'SnmpMgrClose';
result := DllCall("mgmtapi\SnmpMgrClose"
    , "Ptr", session   ; void* in/out
    , "Int")   ; return: BOOL
●SnmpMgrClose(session) = DLL("mgmtapi.dll", "bool SnmpMgrClose(void*)")
# 呼び出し: SnmpMgrClose(session)
# session : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。