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

RasEditPhonebookEntryW

関数
ダイアログで既存の電話帳エントリを編集する(Unicode版)。
DLLRASAPI32.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD RasEditPhonebookEntryW(
    HWND param0,
    LPCWSTR param1,   // optional
    LPCWSTR param2
);

パラメーター

名前方向
param0HWNDin
param1LPCWSTRinoptional
param2LPCWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RasEditPhonebookEntryW(
    HWND param0,
    LPCWSTR param1,   // optional
    LPCWSTR param2
);
[DllImport("RASAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint RasEditPhonebookEntryW(
    IntPtr param0,   // HWND
    [MarshalAs(UnmanagedType.LPWStr)] string param1,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string param2   // LPCWSTR
);
<DllImport("RASAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RasEditPhonebookEntryW(
    param0 As IntPtr,   ' HWND
    <MarshalAs(UnmanagedType.LPWStr)> param1 As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> param2 As String   ' LPCWSTR
) As UInteger
End Function
' param0 : HWND
' param1 : LPCWSTR optional
' param2 : LPCWSTR
Declare PtrSafe Function RasEditPhonebookEntryW Lib "rasapi32" ( _
    ByVal param0 As LongPtr, _
    ByVal param1 As LongPtr, _
    ByVal param2 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

RasEditPhonebookEntryW = ctypes.windll.rasapi32.RasEditPhonebookEntryW
RasEditPhonebookEntryW.restype = wintypes.DWORD
RasEditPhonebookEntryW.argtypes = [
    wintypes.HANDLE,  # param0 : HWND
    wintypes.LPCWSTR,  # param1 : LPCWSTR optional
    wintypes.LPCWSTR,  # param2 : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RASAPI32.dll')
RasEditPhonebookEntryW = Fiddle::Function.new(
  lib['RasEditPhonebookEntryW'],
  [
    Fiddle::TYPE_VOIDP,  # param0 : HWND
    Fiddle::TYPE_VOIDP,  # param1 : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # param2 : LPCWSTR
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rasapi32")]
extern "system" {
    fn RasEditPhonebookEntryW(
        param0: *mut core::ffi::c_void,  // HWND
        param1: *const u16,  // LPCWSTR optional
        param2: *const u16  // LPCWSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RASAPI32.dll", CharSet = CharSet.Unicode)]
public static extern uint RasEditPhonebookEntryW(IntPtr param0, [MarshalAs(UnmanagedType.LPWStr)] string param1, [MarshalAs(UnmanagedType.LPWStr)] string param2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RASAPI32_RasEditPhonebookEntryW' -Namespace Win32 -PassThru
# $api::RasEditPhonebookEntryW(param0, param1, param2)
#uselib "RASAPI32.dll"
#func global RasEditPhonebookEntryW "RasEditPhonebookEntryW" wptr, wptr, wptr
; RasEditPhonebookEntryW param0, param1, param2   ; 戻り値は stat
; param0 : HWND -> "wptr"
; param1 : LPCWSTR optional -> "wptr"
; param2 : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RASAPI32.dll"
#cfunc global RasEditPhonebookEntryW "RasEditPhonebookEntryW" sptr, wstr, wstr
; res = RasEditPhonebookEntryW(param0, param1, param2)
; param0 : HWND -> "sptr"
; param1 : LPCWSTR optional -> "wstr"
; param2 : LPCWSTR -> "wstr"
; DWORD RasEditPhonebookEntryW(HWND param0, LPCWSTR param1, LPCWSTR param2)
#uselib "RASAPI32.dll"
#cfunc global RasEditPhonebookEntryW "RasEditPhonebookEntryW" intptr, wstr, wstr
; res = RasEditPhonebookEntryW(param0, param1, param2)
; param0 : HWND -> "intptr"
; param1 : LPCWSTR optional -> "wstr"
; param2 : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rasapi32 = windows.NewLazySystemDLL("RASAPI32.dll")
	procRasEditPhonebookEntryW = rasapi32.NewProc("RasEditPhonebookEntryW")
)

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