ホーム › NetworkManagement.WNet › WNetConnectionDialog
WNetConnectionDialog
関数ネットワークリソース接続用の標準ダイアログを表示する。
シグネチャ
// MPR.dll
#include <windows.h>
WIN32_ERROR WNetConnectionDialog(
HWND hwnd,
DWORD dwType
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| dwType | DWORD | in |
戻り値の型: WIN32_ERROR
各言語での呼び出し定義
// MPR.dll
#include <windows.h>
WIN32_ERROR WNetConnectionDialog(
HWND hwnd,
DWORD dwType
);[DllImport("MPR.dll", ExactSpelling = true)]
static extern uint WNetConnectionDialog(
IntPtr hwnd, // HWND
uint dwType // DWORD
);<DllImport("MPR.dll", ExactSpelling:=True)>
Public Shared Function WNetConnectionDialog(
hwnd As IntPtr, ' HWND
dwType As UInteger ' DWORD
) As UInteger
End Function' hwnd : HWND
' dwType : DWORD
Declare PtrSafe Function WNetConnectionDialog Lib "mpr" ( _
ByVal hwnd As LongPtr, _
ByVal dwType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WNetConnectionDialog = ctypes.windll.mpr.WNetConnectionDialog
WNetConnectionDialog.restype = wintypes.DWORD
WNetConnectionDialog.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.DWORD, # dwType : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPR.dll')
WNetConnectionDialog = Fiddle::Function.new(
lib['WNetConnectionDialog'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
-Fiddle::TYPE_INT, # dwType : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "mpr")]
extern "system" {
fn WNetConnectionDialog(
hwnd: *mut core::ffi::c_void, // HWND
dwType: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPR.dll")]
public static extern uint WNetConnectionDialog(IntPtr hwnd, uint dwType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPR_WNetConnectionDialog' -Namespace Win32 -PassThru
# $api::WNetConnectionDialog(hwnd, dwType)#uselib "MPR.dll"
#func global WNetConnectionDialog "WNetConnectionDialog" sptr, sptr
; WNetConnectionDialog hwnd, dwType ; 戻り値は stat
; hwnd : HWND -> "sptr"
; dwType : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MPR.dll"
#cfunc global WNetConnectionDialog "WNetConnectionDialog" sptr, int
; res = WNetConnectionDialog(hwnd, dwType)
; hwnd : HWND -> "sptr"
; dwType : DWORD -> "int"; WIN32_ERROR WNetConnectionDialog(HWND hwnd, DWORD dwType)
#uselib "MPR.dll"
#cfunc global WNetConnectionDialog "WNetConnectionDialog" intptr, int
; res = WNetConnectionDialog(hwnd, dwType)
; hwnd : HWND -> "intptr"
; dwType : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mpr = windows.NewLazySystemDLL("MPR.dll")
procWNetConnectionDialog = mpr.NewProc("WNetConnectionDialog")
)
// hwnd (HWND), dwType (DWORD)
r1, _, err := procWNetConnectionDialog.Call(
uintptr(hwnd),
uintptr(dwType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WIN32_ERRORfunction WNetConnectionDialog(
hwnd: THandle; // HWND
dwType: DWORD // DWORD
): DWORD; stdcall;
external 'MPR.dll' name 'WNetConnectionDialog';result := DllCall("MPR\WNetConnectionDialog"
, "Ptr", hwnd ; HWND
, "UInt", dwType ; DWORD
, "UInt") ; return: WIN32_ERROR●WNetConnectionDialog(hwnd, dwType) = DLL("MPR.dll", "dword WNetConnectionDialog(void*, dword)")
# 呼び出し: WNetConnectionDialog(hwnd, dwType)
# hwnd : HWND -> "void*"
# dwType : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。