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

lineGetIDW

関数
回線等に関連するデバイス識別子を取得する(Unicode版)。
DLLTAPI32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT lineGetIDW(
    DWORD hLine,
    DWORD dwAddressID,
    DWORD hCall,
    DWORD dwSelect,
    VARSTRING* lpDeviceID,
    LPCWSTR lpszDeviceClass
);

パラメーター

名前方向
hLineDWORDin
dwAddressIDDWORDin
hCallDWORDin
dwSelectDWORDin
lpDeviceIDVARSTRING*inout
lpszDeviceClassLPCWSTRin

戻り値の型: INT

各言語での呼び出し定義

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

INT lineGetIDW(
    DWORD hLine,
    DWORD dwAddressID,
    DWORD hCall,
    DWORD dwSelect,
    VARSTRING* lpDeviceID,
    LPCWSTR lpszDeviceClass
);
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineGetIDW(
    uint hLine,   // DWORD
    uint dwAddressID,   // DWORD
    uint hCall,   // DWORD
    uint dwSelect,   // DWORD
    IntPtr lpDeviceID,   // VARSTRING* in/out
    [MarshalAs(UnmanagedType.LPWStr)] string lpszDeviceClass   // LPCWSTR
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineGetIDW(
    hLine As UInteger,   ' DWORD
    dwAddressID As UInteger,   ' DWORD
    hCall As UInteger,   ' DWORD
    dwSelect As UInteger,   ' DWORD
    lpDeviceID As IntPtr,   ' VARSTRING* in/out
    <MarshalAs(UnmanagedType.LPWStr)> lpszDeviceClass As String   ' LPCWSTR
) As Integer
End Function
' hLine : DWORD
' dwAddressID : DWORD
' hCall : DWORD
' dwSelect : DWORD
' lpDeviceID : VARSTRING* in/out
' lpszDeviceClass : LPCWSTR
Declare PtrSafe Function lineGetIDW Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByVal dwAddressID As Long, _
    ByVal hCall As Long, _
    ByVal dwSelect As Long, _
    ByVal lpDeviceID As LongPtr, _
    ByVal lpszDeviceClass 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

lineGetIDW = ctypes.windll.tapi32.lineGetIDW
lineGetIDW.restype = ctypes.c_int
lineGetIDW.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    wintypes.DWORD,  # dwAddressID : DWORD
    wintypes.DWORD,  # hCall : DWORD
    wintypes.DWORD,  # dwSelect : DWORD
    ctypes.c_void_p,  # lpDeviceID : VARSTRING* in/out
    wintypes.LPCWSTR,  # lpszDeviceClass : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
lineGetIDW = Fiddle::Function.new(
  lib['lineGetIDW'],
  [
    -Fiddle::TYPE_INT,  # hLine : DWORD
    -Fiddle::TYPE_INT,  # dwAddressID : DWORD
    -Fiddle::TYPE_INT,  # hCall : DWORD
    -Fiddle::TYPE_INT,  # dwSelect : DWORD
    Fiddle::TYPE_VOIDP,  # lpDeviceID : VARSTRING* in/out
    Fiddle::TYPE_VOIDP,  # lpszDeviceClass : LPCWSTR
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "tapi32")]
extern "system" {
    fn lineGetIDW(
        hLine: u32,  // DWORD
        dwAddressID: u32,  // DWORD
        hCall: u32,  // DWORD
        dwSelect: u32,  // DWORD
        lpDeviceID: *mut VARSTRING,  // VARSTRING* in/out
        lpszDeviceClass: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode)]
public static extern int lineGetIDW(uint hLine, uint dwAddressID, uint hCall, uint dwSelect, IntPtr lpDeviceID, [MarshalAs(UnmanagedType.LPWStr)] string lpszDeviceClass);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetIDW' -Namespace Win32 -PassThru
# $api::lineGetIDW(hLine, dwAddressID, hCall, dwSelect, lpDeviceID, lpszDeviceClass)
#uselib "TAPI32.dll"
#func global lineGetIDW "lineGetIDW" wptr, wptr, wptr, wptr, wptr, wptr
; lineGetIDW hLine, dwAddressID, hCall, dwSelect, varptr(lpDeviceID), lpszDeviceClass   ; 戻り値は stat
; hLine : DWORD -> "wptr"
; dwAddressID : DWORD -> "wptr"
; hCall : DWORD -> "wptr"
; dwSelect : DWORD -> "wptr"
; lpDeviceID : VARSTRING* in/out -> "wptr"
; lpszDeviceClass : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "TAPI32.dll"
#cfunc global lineGetIDW "lineGetIDW" int, int, int, int, var, wstr
; res = lineGetIDW(hLine, dwAddressID, hCall, dwSelect, lpDeviceID, lpszDeviceClass)
; hLine : DWORD -> "int"
; dwAddressID : DWORD -> "int"
; hCall : DWORD -> "int"
; dwSelect : DWORD -> "int"
; lpDeviceID : VARSTRING* in/out -> "var"
; lpszDeviceClass : LPCWSTR -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT lineGetIDW(DWORD hLine, DWORD dwAddressID, DWORD hCall, DWORD dwSelect, VARSTRING* lpDeviceID, LPCWSTR lpszDeviceClass)
#uselib "TAPI32.dll"
#cfunc global lineGetIDW "lineGetIDW" int, int, int, int, var, wstr
; res = lineGetIDW(hLine, dwAddressID, hCall, dwSelect, lpDeviceID, lpszDeviceClass)
; hLine : DWORD -> "int"
; dwAddressID : DWORD -> "int"
; hCall : DWORD -> "int"
; dwSelect : DWORD -> "int"
; lpDeviceID : VARSTRING* in/out -> "var"
; lpszDeviceClass : LPCWSTR -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineGetIDW = tapi32.NewProc("lineGetIDW")
)

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