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