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

WNetConnectionDialog1A

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

シグネチャ

// MPR.dll  (ANSI / -A)
#include <windows.h>

WIN32_ERROR WNetConnectionDialog1A(
    CONNECTDLGSTRUCTA* lpConnDlgStruct
);

パラメーター

名前方向
lpConnDlgStructCONNECTDLGSTRUCTA*inout

戻り値の型: WIN32_ERROR

各言語での呼び出し定義

// MPR.dll  (ANSI / -A)
#include <windows.h>

WIN32_ERROR WNetConnectionDialog1A(
    CONNECTDLGSTRUCTA* lpConnDlgStruct
);
[DllImport("MPR.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint WNetConnectionDialog1A(
    IntPtr lpConnDlgStruct   // CONNECTDLGSTRUCTA* in/out
);
<DllImport("MPR.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function WNetConnectionDialog1A(
    lpConnDlgStruct As IntPtr   ' CONNECTDLGSTRUCTA* in/out
) As UInteger
End Function
' lpConnDlgStruct : CONNECTDLGSTRUCTA* in/out
Declare PtrSafe Function WNetConnectionDialog1A Lib "mpr" ( _
    ByVal lpConnDlgStruct As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	mpr = windows.NewLazySystemDLL("MPR.dll")
	procWNetConnectionDialog1A = mpr.NewProc("WNetConnectionDialog1A")
)

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