Win32 API 日本語リファレンス
ホームNetworking.WinInet › InternetDialW

InternetDialW

関数
指定接続でダイヤルアップ接続を確立する(Unicode版)。
DLLWININET.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD InternetDialW(
    HWND hwndParent,
    LPWSTR lpszConnectoid,   // optional
    DWORD dwFlags,
    UINT_PTR* lpdwConnection,
    DWORD dwReserved   // optional
);

パラメーター

名前方向
hwndParentHWNDin
lpszConnectoidLPWSTRinoptional
dwFlagsDWORDin
lpdwConnectionUINT_PTR*out
dwReservedDWORDoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD InternetDialW(
    HWND hwndParent,
    LPWSTR lpszConnectoid,   // optional
    DWORD dwFlags,
    UINT_PTR* lpdwConnection,
    DWORD dwReserved   // optional
);
[DllImport("WININET.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint InternetDialW(
    IntPtr hwndParent,   // HWND
    [MarshalAs(UnmanagedType.LPWStr)] string lpszConnectoid,   // LPWSTR optional
    uint dwFlags,   // DWORD
    out UIntPtr lpdwConnection,   // UINT_PTR* out
    uint dwReserved   // DWORD optional
);
<DllImport("WININET.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function InternetDialW(
    hwndParent As IntPtr,   ' HWND
    <MarshalAs(UnmanagedType.LPWStr)> lpszConnectoid As String,   ' LPWSTR optional
    dwFlags As UInteger,   ' DWORD
    <Out> ByRef lpdwConnection As UIntPtr,   ' UINT_PTR* out
    dwReserved As UInteger   ' DWORD optional
) As UInteger
End Function
' hwndParent : HWND
' lpszConnectoid : LPWSTR optional
' dwFlags : DWORD
' lpdwConnection : UINT_PTR* out
' dwReserved : DWORD optional
Declare PtrSafe Function InternetDialW Lib "wininet" ( _
    ByVal hwndParent As LongPtr, _
    ByVal lpszConnectoid As LongPtr, _
    ByVal dwFlags As Long, _
    ByRef lpdwConnection As LongPtr, _
    ByVal dwReserved As Long) 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

InternetDialW = ctypes.windll.wininet.InternetDialW
InternetDialW.restype = wintypes.DWORD
InternetDialW.argtypes = [
    wintypes.HANDLE,  # hwndParent : HWND
    wintypes.LPCWSTR,  # lpszConnectoid : LPWSTR optional
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.POINTER(ctypes.c_size_t),  # lpdwConnection : UINT_PTR* out
    wintypes.DWORD,  # dwReserved : DWORD optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
InternetDialW = Fiddle::Function.new(
  lib['InternetDialW'],
  [
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND
    Fiddle::TYPE_VOIDP,  # lpszConnectoid : LPWSTR optional
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # lpdwConnection : UINT_PTR* out
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "wininet")]
extern "system" {
    fn InternetDialW(
        hwndParent: *mut core::ffi::c_void,  // HWND
        lpszConnectoid: *mut u16,  // LPWSTR optional
        dwFlags: u32,  // DWORD
        lpdwConnection: *mut usize,  // UINT_PTR* out
        dwReserved: u32  // DWORD optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WININET.dll", CharSet = CharSet.Unicode)]
public static extern uint InternetDialW(IntPtr hwndParent, [MarshalAs(UnmanagedType.LPWStr)] string lpszConnectoid, uint dwFlags, out UIntPtr lpdwConnection, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_InternetDialW' -Namespace Win32 -PassThru
# $api::InternetDialW(hwndParent, lpszConnectoid, dwFlags, lpdwConnection, dwReserved)
#uselib "WININET.dll"
#func global InternetDialW "InternetDialW" wptr, wptr, wptr, wptr, wptr
; InternetDialW hwndParent, lpszConnectoid, dwFlags, varptr(lpdwConnection), dwReserved   ; 戻り値は stat
; hwndParent : HWND -> "wptr"
; lpszConnectoid : LPWSTR optional -> "wptr"
; dwFlags : DWORD -> "wptr"
; lpdwConnection : UINT_PTR* out -> "wptr"
; dwReserved : DWORD optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WININET.dll"
#cfunc global InternetDialW "InternetDialW" sptr, wstr, int, var, int
; res = InternetDialW(hwndParent, lpszConnectoid, dwFlags, lpdwConnection, dwReserved)
; hwndParent : HWND -> "sptr"
; lpszConnectoid : LPWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; lpdwConnection : UINT_PTR* out -> "var"
; dwReserved : DWORD optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD InternetDialW(HWND hwndParent, LPWSTR lpszConnectoid, DWORD dwFlags, UINT_PTR* lpdwConnection, DWORD dwReserved)
#uselib "WININET.dll"
#cfunc global InternetDialW "InternetDialW" intptr, wstr, int, var, int
; res = InternetDialW(hwndParent, lpszConnectoid, dwFlags, lpdwConnection, dwReserved)
; hwndParent : HWND -> "intptr"
; lpszConnectoid : LPWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; lpdwConnection : UINT_PTR* out -> "var"
; dwReserved : DWORD optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procInternetDialW = wininet.NewProc("InternetDialW")
)

// hwndParent (HWND), lpszConnectoid (LPWSTR optional), dwFlags (DWORD), lpdwConnection (UINT_PTR* out), dwReserved (DWORD optional)
r1, _, err := procInternetDialW.Call(
	uintptr(hwndParent),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszConnectoid))),
	uintptr(dwFlags),
	uintptr(lpdwConnection),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function InternetDialW(
  hwndParent: THandle;   // HWND
  lpszConnectoid: PWideChar;   // LPWSTR optional
  dwFlags: DWORD;   // DWORD
  lpdwConnection: Pointer;   // UINT_PTR* out
  dwReserved: DWORD   // DWORD optional
): DWORD; stdcall;
  external 'WININET.dll' name 'InternetDialW';
result := DllCall("WININET\InternetDialW"
    , "Ptr", hwndParent   ; HWND
    , "WStr", lpszConnectoid   ; LPWSTR optional
    , "UInt", dwFlags   ; DWORD
    , "Ptr", lpdwConnection   ; UINT_PTR* out
    , "UInt", dwReserved   ; DWORD optional
    , "UInt")   ; return: DWORD
●InternetDialW(hwndParent, lpszConnectoid, dwFlags, lpdwConnection, dwReserved) = DLL("WININET.dll", "dword InternetDialW(void*, char*, dword, void*, dword)")
# 呼び出し: InternetDialW(hwndParent, lpszConnectoid, dwFlags, lpdwConnection, dwReserved)
# hwndParent : HWND -> "void*"
# lpszConnectoid : LPWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# lpdwConnection : UINT_PTR* out -> "void*"
# dwReserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。