ホーム › Devices.Tapi › lineGetDevConfigW
lineGetDevConfigW
関数回線デバイスのメディア構成情報を取得する(Unicode版)。
シグネチャ
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT lineGetDevConfigW(
DWORD dwDeviceID,
VARSTRING* lpDeviceConfig,
LPCWSTR lpszDeviceClass
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwDeviceID | DWORD | in |
| lpDeviceConfig | VARSTRING* | inout |
| lpszDeviceClass | LPCWSTR | in |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT lineGetDevConfigW(
DWORD dwDeviceID,
VARSTRING* lpDeviceConfig,
LPCWSTR lpszDeviceClass
);[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineGetDevConfigW(
uint dwDeviceID, // DWORD
IntPtr lpDeviceConfig, // VARSTRING* in/out
[MarshalAs(UnmanagedType.LPWStr)] string lpszDeviceClass // LPCWSTR
);<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineGetDevConfigW(
dwDeviceID As UInteger, ' DWORD
lpDeviceConfig As IntPtr, ' VARSTRING* in/out
<MarshalAs(UnmanagedType.LPWStr)> lpszDeviceClass As String ' LPCWSTR
) As Integer
End Function' dwDeviceID : DWORD
' lpDeviceConfig : VARSTRING* in/out
' lpszDeviceClass : LPCWSTR
Declare PtrSafe Function lineGetDevConfigW Lib "tapi32" ( _
ByVal dwDeviceID As Long, _
ByVal lpDeviceConfig 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
lineGetDevConfigW = ctypes.windll.tapi32.lineGetDevConfigW
lineGetDevConfigW.restype = ctypes.c_int
lineGetDevConfigW.argtypes = [
wintypes.DWORD, # dwDeviceID : DWORD
ctypes.c_void_p, # lpDeviceConfig : VARSTRING* in/out
wintypes.LPCWSTR, # lpszDeviceClass : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
lineGetDevConfigW = Fiddle::Function.new(
lib['lineGetDevConfigW'],
[
-Fiddle::TYPE_INT, # dwDeviceID : DWORD
Fiddle::TYPE_VOIDP, # lpDeviceConfig : 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 lineGetDevConfigW(
dwDeviceID: u32, // DWORD
lpDeviceConfig: *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 lineGetDevConfigW(uint dwDeviceID, IntPtr lpDeviceConfig, [MarshalAs(UnmanagedType.LPWStr)] string lpszDeviceClass);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetDevConfigW' -Namespace Win32 -PassThru
# $api::lineGetDevConfigW(dwDeviceID, lpDeviceConfig, lpszDeviceClass)#uselib "TAPI32.dll"
#func global lineGetDevConfigW "lineGetDevConfigW" wptr, wptr, wptr
; lineGetDevConfigW dwDeviceID, varptr(lpDeviceConfig), lpszDeviceClass ; 戻り値は stat
; dwDeviceID : DWORD -> "wptr"
; lpDeviceConfig : VARSTRING* in/out -> "wptr"
; lpszDeviceClass : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global lineGetDevConfigW "lineGetDevConfigW" int, var, wstr ; res = lineGetDevConfigW(dwDeviceID, lpDeviceConfig, lpszDeviceClass) ; dwDeviceID : DWORD -> "int" ; lpDeviceConfig : VARSTRING* in/out -> "var" ; lpszDeviceClass : LPCWSTR -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "TAPI32.dll" #cfunc global lineGetDevConfigW "lineGetDevConfigW" int, sptr, wstr ; res = lineGetDevConfigW(dwDeviceID, varptr(lpDeviceConfig), lpszDeviceClass) ; dwDeviceID : DWORD -> "int" ; lpDeviceConfig : VARSTRING* in/out -> "sptr" ; lpszDeviceClass : LPCWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT lineGetDevConfigW(DWORD dwDeviceID, VARSTRING* lpDeviceConfig, LPCWSTR lpszDeviceClass) #uselib "TAPI32.dll" #cfunc global lineGetDevConfigW "lineGetDevConfigW" int, var, wstr ; res = lineGetDevConfigW(dwDeviceID, lpDeviceConfig, lpszDeviceClass) ; dwDeviceID : DWORD -> "int" ; lpDeviceConfig : VARSTRING* in/out -> "var" ; lpszDeviceClass : LPCWSTR -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT lineGetDevConfigW(DWORD dwDeviceID, VARSTRING* lpDeviceConfig, LPCWSTR lpszDeviceClass) #uselib "TAPI32.dll" #cfunc global lineGetDevConfigW "lineGetDevConfigW" int, intptr, wstr ; res = lineGetDevConfigW(dwDeviceID, varptr(lpDeviceConfig), lpszDeviceClass) ; dwDeviceID : DWORD -> "int" ; lpDeviceConfig : VARSTRING* in/out -> "intptr" ; lpszDeviceClass : LPCWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
proclineGetDevConfigW = tapi32.NewProc("lineGetDevConfigW")
)
// dwDeviceID (DWORD), lpDeviceConfig (VARSTRING* in/out), lpszDeviceClass (LPCWSTR)
r1, _, err := proclineGetDevConfigW.Call(
uintptr(dwDeviceID),
uintptr(lpDeviceConfig),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszDeviceClass))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction lineGetDevConfigW(
dwDeviceID: DWORD; // DWORD
lpDeviceConfig: Pointer; // VARSTRING* in/out
lpszDeviceClass: PWideChar // LPCWSTR
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetDevConfigW';result := DllCall("TAPI32\lineGetDevConfigW"
, "UInt", dwDeviceID ; DWORD
, "Ptr", lpDeviceConfig ; VARSTRING* in/out
, "WStr", lpszDeviceClass ; LPCWSTR
, "Int") ; return: INT●lineGetDevConfigW(dwDeviceID, lpDeviceConfig, lpszDeviceClass) = DLL("TAPI32.dll", "int lineGetDevConfigW(dword, void*, char*)")
# 呼び出し: lineGetDevConfigW(dwDeviceID, lpDeviceConfig, lpszDeviceClass)
# dwDeviceID : DWORD -> "dword"
# lpDeviceConfig : VARSTRING* in/out -> "void*"
# lpszDeviceClass : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。