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

WNetDisconnectDialog1W

関数
構造体を指定して切断ダイアログを表示する(Unicode版)。
DLLMPR.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// MPR.dll  (Unicode / -W)
#include <windows.h>

WIN32_ERROR WNetDisconnectDialog1W(
    DISCDLGSTRUCTW* lpConnDlgStruct
);

パラメーター

名前方向
lpConnDlgStructDISCDLGSTRUCTW*in

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

// MPR.dll  (Unicode / -W)
#include <windows.h>

WIN32_ERROR WNetDisconnectDialog1W(
    DISCDLGSTRUCTW* lpConnDlgStruct
);
[DllImport("MPR.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint WNetDisconnectDialog1W(
    IntPtr lpConnDlgStruct   // DISCDLGSTRUCTW*
);
<DllImport("MPR.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function WNetDisconnectDialog1W(
    lpConnDlgStruct As IntPtr   ' DISCDLGSTRUCTW*
) As UInteger
End Function
' lpConnDlgStruct : DISCDLGSTRUCTW*
Declare PtrSafe Function WNetDisconnectDialog1W Lib "mpr" ( _
    ByVal lpConnDlgStruct As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WNetDisconnectDialog1W = ctypes.windll.mpr.WNetDisconnectDialog1W
WNetDisconnectDialog1W.restype = wintypes.DWORD
WNetDisconnectDialog1W.argtypes = [
    ctypes.c_void_p,  # lpConnDlgStruct : DISCDLGSTRUCTW*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MPR.dll')
WNetDisconnectDialog1W = Fiddle::Function.new(
  lib['WNetDisconnectDialog1W'],
  [
    Fiddle::TYPE_VOIDP,  # lpConnDlgStruct : DISCDLGSTRUCTW*
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "mpr")]
extern "system" {
    fn WNetDisconnectDialog1W(
        lpConnDlgStruct: *mut DISCDLGSTRUCTW  // DISCDLGSTRUCTW*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MPR.dll", CharSet = CharSet.Unicode)]
public static extern uint WNetDisconnectDialog1W(IntPtr lpConnDlgStruct);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPR_WNetDisconnectDialog1W' -Namespace Win32 -PassThru
# $api::WNetDisconnectDialog1W(lpConnDlgStruct)
#uselib "MPR.dll"
#func global WNetDisconnectDialog1W "WNetDisconnectDialog1W" wptr
; WNetDisconnectDialog1W varptr(lpConnDlgStruct)   ; 戻り値は stat
; lpConnDlgStruct : DISCDLGSTRUCTW* -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MPR.dll"
#cfunc global WNetDisconnectDialog1W "WNetDisconnectDialog1W" var
; res = WNetDisconnectDialog1W(lpConnDlgStruct)
; lpConnDlgStruct : DISCDLGSTRUCTW* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; WIN32_ERROR WNetDisconnectDialog1W(DISCDLGSTRUCTW* lpConnDlgStruct)
#uselib "MPR.dll"
#cfunc global WNetDisconnectDialog1W "WNetDisconnectDialog1W" var
; res = WNetDisconnectDialog1W(lpConnDlgStruct)
; lpConnDlgStruct : DISCDLGSTRUCTW* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mpr = windows.NewLazySystemDLL("MPR.dll")
	procWNetDisconnectDialog1W = mpr.NewProc("WNetDisconnectDialog1W")
)

// lpConnDlgStruct (DISCDLGSTRUCTW*)
r1, _, err := procWNetDisconnectDialog1W.Call(
	uintptr(lpConnDlgStruct),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // WIN32_ERROR
function WNetDisconnectDialog1W(
  lpConnDlgStruct: Pointer   // DISCDLGSTRUCTW*
): DWORD; stdcall;
  external 'MPR.dll' name 'WNetDisconnectDialog1W';
result := DllCall("MPR\WNetDisconnectDialog1W"
    , "Ptr", lpConnDlgStruct   ; DISCDLGSTRUCTW*
    , "UInt")   ; return: WIN32_ERROR
●WNetDisconnectDialog1W(lpConnDlgStruct) = DLL("MPR.dll", "dword WNetDisconnectDialog1W(void*)")
# 呼び出し: WNetDisconnectDialog1W(lpConnDlgStruct)
# lpConnDlgStruct : DISCDLGSTRUCTW* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。