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

DnsConnectionDeleteProxyInfo

関数
指定接続のプロキシ情報を削除する。
DLLDNSAPI.dll呼出規約winapi

シグネチャ

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

DWORD DnsConnectionDeleteProxyInfo(
    LPCWSTR pwszConnectionName,
    DNS_CONNECTION_PROXY_TYPE Type
);

パラメーター

名前方向
pwszConnectionNameLPCWSTRin
TypeDNS_CONNECTION_PROXY_TYPEin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD DnsConnectionDeleteProxyInfo(
    LPCWSTR pwszConnectionName,
    DNS_CONNECTION_PROXY_TYPE Type
);
[DllImport("DNSAPI.dll", ExactSpelling = true)]
static extern uint DnsConnectionDeleteProxyInfo(
    [MarshalAs(UnmanagedType.LPWStr)] string pwszConnectionName,   // LPCWSTR
    int Type   // DNS_CONNECTION_PROXY_TYPE
);
<DllImport("DNSAPI.dll", ExactSpelling:=True)>
Public Shared Function DnsConnectionDeleteProxyInfo(
    <MarshalAs(UnmanagedType.LPWStr)> pwszConnectionName As String,   ' LPCWSTR
    Type As Integer   ' DNS_CONNECTION_PROXY_TYPE
) As UInteger
End Function
' pwszConnectionName : LPCWSTR
' Type : DNS_CONNECTION_PROXY_TYPE
Declare PtrSafe Function DnsConnectionDeleteProxyInfo Lib "dnsapi" ( _
    ByVal pwszConnectionName As LongPtr, _
    ByVal Type As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DnsConnectionDeleteProxyInfo = ctypes.windll.dnsapi.DnsConnectionDeleteProxyInfo
DnsConnectionDeleteProxyInfo.restype = wintypes.DWORD
DnsConnectionDeleteProxyInfo.argtypes = [
    wintypes.LPCWSTR,  # pwszConnectionName : LPCWSTR
    ctypes.c_int,  # Type : DNS_CONNECTION_PROXY_TYPE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
	procDnsConnectionDeleteProxyInfo = dnsapi.NewProc("DnsConnectionDeleteProxyInfo")
)

// pwszConnectionName (LPCWSTR), Type (DNS_CONNECTION_PROXY_TYPE)
r1, _, err := procDnsConnectionDeleteProxyInfo.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszConnectionName))),
	uintptr(Type),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function DnsConnectionDeleteProxyInfo(
  pwszConnectionName: PWideChar;   // LPCWSTR
  Type: Integer   // DNS_CONNECTION_PROXY_TYPE
): DWORD; stdcall;
  external 'DNSAPI.dll' name 'DnsConnectionDeleteProxyInfo';
result := DllCall("DNSAPI\DnsConnectionDeleteProxyInfo"
    , "WStr", pwszConnectionName   ; LPCWSTR
    , "Int", Type   ; DNS_CONNECTION_PROXY_TYPE
    , "UInt")   ; return: DWORD
●DnsConnectionDeleteProxyInfo(pwszConnectionName, Type) = DLL("DNSAPI.dll", "dword DnsConnectionDeleteProxyInfo(char*, int)")
# 呼び出し: DnsConnectionDeleteProxyInfo(pwszConnectionName, Type)
# pwszConnectionName : LPCWSTR -> "char*"
# Type : DNS_CONNECTION_PROXY_TYPE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。