Win32 API 日本語リファレンス
ホームDevices.Tapi › lineSetTollListW

lineSetTollListW

関数
市外通話料金リストをUnicode文字列で設定する。
DLLTAPI32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT lineSetTollListW(
    DWORD hLineApp,
    DWORD dwDeviceID,
    LPCWSTR lpszAddressInW,
    DWORD dwTollListOption
);

パラメーター

名前方向
hLineAppDWORDin
dwDeviceIDDWORDin
lpszAddressInWLPCWSTRin
dwTollListOptionDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

INT lineSetTollListW(
    DWORD hLineApp,
    DWORD dwDeviceID,
    LPCWSTR lpszAddressInW,
    DWORD dwTollListOption
);
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineSetTollListW(
    uint hLineApp,   // DWORD
    uint dwDeviceID,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string lpszAddressInW,   // LPCWSTR
    uint dwTollListOption   // DWORD
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineSetTollListW(
    hLineApp As UInteger,   ' DWORD
    dwDeviceID As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> lpszAddressInW As String,   ' LPCWSTR
    dwTollListOption As UInteger   ' DWORD
) As Integer
End Function
' hLineApp : DWORD
' dwDeviceID : DWORD
' lpszAddressInW : LPCWSTR
' dwTollListOption : DWORD
Declare PtrSafe Function lineSetTollListW Lib "tapi32" ( _
    ByVal hLineApp As Long, _
    ByVal dwDeviceID As Long, _
    ByVal lpszAddressInW As LongPtr, _
    ByVal dwTollListOption 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

lineSetTollListW = ctypes.windll.tapi32.lineSetTollListW
lineSetTollListW.restype = ctypes.c_int
lineSetTollListW.argtypes = [
    wintypes.DWORD,  # hLineApp : DWORD
    wintypes.DWORD,  # dwDeviceID : DWORD
    wintypes.LPCWSTR,  # lpszAddressInW : LPCWSTR
    wintypes.DWORD,  # dwTollListOption : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineSetTollListW = tapi32.NewProc("lineSetTollListW")
)

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