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

SnmpCancelMsg

関数
指定した要求IDの保留中WinSNMPメッセージを取り消す。
DLLwsnmp32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD SnmpCancelMsg(
    INT_PTR session,
    INT reqId
);

パラメーター

名前方向
sessionINT_PTRin
reqIdINTin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

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

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

var (
	wsnmp32 = windows.NewLazySystemDLL("wsnmp32.dll")
	procSnmpCancelMsg = wsnmp32.NewProc("SnmpCancelMsg")
)

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