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

WNetConnectionDialog1W

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

シグネチャ

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

WIN32_ERROR WNetConnectionDialog1W(
    CONNECTDLGSTRUCTW* lpConnDlgStruct
);

パラメーター

名前方向
lpConnDlgStructCONNECTDLGSTRUCTW*inout

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

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

WIN32_ERROR WNetConnectionDialog1W(
    CONNECTDLGSTRUCTW* lpConnDlgStruct
);
[DllImport("MPR.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint WNetConnectionDialog1W(
    IntPtr lpConnDlgStruct   // CONNECTDLGSTRUCTW* in/out
);
<DllImport("MPR.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function WNetConnectionDialog1W(
    lpConnDlgStruct As IntPtr   ' CONNECTDLGSTRUCTW* in/out
) As UInteger
End Function
' lpConnDlgStruct : CONNECTDLGSTRUCTW* in/out
Declare PtrSafe Function WNetConnectionDialog1W 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

WNetConnectionDialog1W = ctypes.windll.mpr.WNetConnectionDialog1W
WNetConnectionDialog1W.restype = wintypes.DWORD
WNetConnectionDialog1W.argtypes = [
    ctypes.c_void_p,  # lpConnDlgStruct : CONNECTDLGSTRUCTW* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mpr = windows.NewLazySystemDLL("MPR.dll")
	procWNetConnectionDialog1W = mpr.NewProc("WNetConnectionDialog1W")
)

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