ホーム › NetworkManagement.NetManagement › NetAlertRaise
NetAlertRaise
関数登録されたクライアントにネットワークアラートを通知する。
シグネチャ
// NETAPI32.dll
#include <windows.h>
DWORD NetAlertRaise(
LPCWSTR AlertType,
void* Buffer,
DWORD BufferSize
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| AlertType | LPCWSTR | in |
| Buffer | void* | in |
| BufferSize | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// NETAPI32.dll
#include <windows.h>
DWORD NetAlertRaise(
LPCWSTR AlertType,
void* Buffer,
DWORD BufferSize
);[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint NetAlertRaise(
[MarshalAs(UnmanagedType.LPWStr)] string AlertType, // LPCWSTR
IntPtr Buffer, // void*
uint BufferSize // DWORD
);<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function NetAlertRaise(
<MarshalAs(UnmanagedType.LPWStr)> AlertType As String, ' LPCWSTR
Buffer As IntPtr, ' void*
BufferSize As UInteger ' DWORD
) As UInteger
End Function' AlertType : LPCWSTR
' Buffer : void*
' BufferSize : DWORD
Declare PtrSafe Function NetAlertRaise Lib "netapi32" ( _
ByVal AlertType As LongPtr, _
ByVal Buffer As LongPtr, _
ByVal BufferSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NetAlertRaise = ctypes.windll.netapi32.NetAlertRaise
NetAlertRaise.restype = wintypes.DWORD
NetAlertRaise.argtypes = [
wintypes.LPCWSTR, # AlertType : LPCWSTR
ctypes.POINTER(None), # Buffer : void*
wintypes.DWORD, # BufferSize : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NETAPI32.dll')
NetAlertRaise = Fiddle::Function.new(
lib['NetAlertRaise'],
[
Fiddle::TYPE_VOIDP, # AlertType : LPCWSTR
Fiddle::TYPE_VOIDP, # Buffer : void*
-Fiddle::TYPE_INT, # BufferSize : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "netapi32")]
extern "system" {
fn NetAlertRaise(
AlertType: *const u16, // LPCWSTR
Buffer: *mut (), // void*
BufferSize: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NETAPI32.dll")]
public static extern uint NetAlertRaise([MarshalAs(UnmanagedType.LPWStr)] string AlertType, IntPtr Buffer, uint BufferSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_NetAlertRaise' -Namespace Win32 -PassThru
# $api::NetAlertRaise(AlertType, Buffer, BufferSize)#uselib "NETAPI32.dll"
#func global NetAlertRaise "NetAlertRaise" sptr, sptr, sptr
; NetAlertRaise AlertType, Buffer, BufferSize ; 戻り値は stat
; AlertType : LPCWSTR -> "sptr"
; Buffer : void* -> "sptr"
; BufferSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "NETAPI32.dll"
#cfunc global NetAlertRaise "NetAlertRaise" wstr, sptr, int
; res = NetAlertRaise(AlertType, Buffer, BufferSize)
; AlertType : LPCWSTR -> "wstr"
; Buffer : void* -> "sptr"
; BufferSize : DWORD -> "int"; DWORD NetAlertRaise(LPCWSTR AlertType, void* Buffer, DWORD BufferSize)
#uselib "NETAPI32.dll"
#cfunc global NetAlertRaise "NetAlertRaise" wstr, intptr, int
; res = NetAlertRaise(AlertType, Buffer, BufferSize)
; AlertType : LPCWSTR -> "wstr"
; Buffer : void* -> "intptr"
; BufferSize : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
procNetAlertRaise = netapi32.NewProc("NetAlertRaise")
)
// AlertType (LPCWSTR), Buffer (void*), BufferSize (DWORD)
r1, _, err := procNetAlertRaise.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(AlertType))),
uintptr(Buffer),
uintptr(BufferSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction NetAlertRaise(
AlertType: PWideChar; // LPCWSTR
Buffer: Pointer; // void*
BufferSize: DWORD // DWORD
): DWORD; stdcall;
external 'NETAPI32.dll' name 'NetAlertRaise';result := DllCall("NETAPI32\NetAlertRaise"
, "WStr", AlertType ; LPCWSTR
, "Ptr", Buffer ; void*
, "UInt", BufferSize ; DWORD
, "UInt") ; return: DWORD●NetAlertRaise(AlertType, Buffer, BufferSize) = DLL("NETAPI32.dll", "dword NetAlertRaise(char*, void*, dword)")
# 呼び出し: NetAlertRaise(AlertType, Buffer, BufferSize)
# AlertType : LPCWSTR -> "char*"
# Buffer : void* -> "void*"
# BufferSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。