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

SnmpClose

関数
WinSNMPセッションを閉じて関連リソースを解放する。
DLLwsnmp32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD SnmpClose(
    INT_PTR session
);

パラメーター

名前方向
sessionINT_PTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD SnmpClose(
    INT_PTR session
);
[DllImport("wsnmp32.dll", ExactSpelling = true)]
static extern uint SnmpClose(
    IntPtr session   // INT_PTR
);
<DllImport("wsnmp32.dll", ExactSpelling:=True)>
Public Shared Function SnmpClose(
    session As IntPtr   ' INT_PTR
) As UInteger
End Function
' session : INT_PTR
Declare PtrSafe Function SnmpClose Lib "wsnmp32" ( _
    ByVal session As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SnmpClose = ctypes.windll.wsnmp32.SnmpClose
SnmpClose.restype = wintypes.DWORD
SnmpClose.argtypes = [
    ctypes.c_ssize_t,  # session : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsnmp32.dll')
SnmpClose = Fiddle::Function.new(
  lib['SnmpClose'],
  [
    Fiddle::TYPE_INTPTR_T,  # session : INT_PTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wsnmp32")]
extern "system" {
    fn SnmpClose(
        session: isize  // INT_PTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsnmp32.dll")]
public static extern uint SnmpClose(IntPtr session);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsnmp32_SnmpClose' -Namespace Win32 -PassThru
# $api::SnmpClose(session)
#uselib "wsnmp32.dll"
#func global SnmpClose "SnmpClose" sptr
; SnmpClose session   ; 戻り値は stat
; session : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wsnmp32.dll"
#cfunc global SnmpClose "SnmpClose" sptr
; res = SnmpClose(session)
; session : INT_PTR -> "sptr"
; DWORD SnmpClose(INT_PTR session)
#uselib "wsnmp32.dll"
#cfunc global SnmpClose "SnmpClose" intptr
; res = SnmpClose(session)
; session : INT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsnmp32 = windows.NewLazySystemDLL("wsnmp32.dll")
	procSnmpClose = wsnmp32.NewProc("SnmpClose")
)

// session (INT_PTR)
r1, _, err := procSnmpClose.Call(
	uintptr(session),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SnmpClose(
  session: NativeInt   // INT_PTR
): DWORD; stdcall;
  external 'wsnmp32.dll' name 'SnmpClose';
result := DllCall("wsnmp32\SnmpClose"
    , "Ptr", session   ; INT_PTR
    , "UInt")   ; return: DWORD
●SnmpClose(session) = DLL("wsnmp32.dll", "dword SnmpClose(int)")
# 呼び出し: SnmpClose(session)
# session : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。