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

DeleteIPAddress

関数
AddIPAddressで追加したIPv4アドレスを削除する。
DLLIPHLPAPI.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD DeleteIPAddress(
    DWORD NTEContext
);

パラメーター

名前方向
NTEContextDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

DeleteIPAddress = ctypes.windll.iphlpapi.DeleteIPAddress
DeleteIPAddress.restype = wintypes.DWORD
DeleteIPAddress.argtypes = [
    wintypes.DWORD,  # NTEContext : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procDeleteIPAddress = iphlpapi.NewProc("DeleteIPAddress")
)

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