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

phoneGetDevCapsW

関数
電話デバイスの能力を取得する関数のUnicode版。
DLLTAPI32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT phoneGetDevCapsW(
    DWORD hPhoneApp,
    DWORD dwDeviceID,
    DWORD dwAPIVersion,
    DWORD dwExtVersion,
    PHONECAPS* lpPhoneCaps
);

パラメーター

名前方向
hPhoneAppDWORDin
dwDeviceIDDWORDin
dwAPIVersionDWORDin
dwExtVersionDWORDin
lpPhoneCapsPHONECAPS*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT phoneGetDevCapsW(
    DWORD hPhoneApp,
    DWORD dwDeviceID,
    DWORD dwAPIVersion,
    DWORD dwExtVersion,
    PHONECAPS* lpPhoneCaps
);
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int phoneGetDevCapsW(
    uint hPhoneApp,   // DWORD
    uint dwDeviceID,   // DWORD
    uint dwAPIVersion,   // DWORD
    uint dwExtVersion,   // DWORD
    IntPtr lpPhoneCaps   // PHONECAPS* in/out
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function phoneGetDevCapsW(
    hPhoneApp As UInteger,   ' DWORD
    dwDeviceID As UInteger,   ' DWORD
    dwAPIVersion As UInteger,   ' DWORD
    dwExtVersion As UInteger,   ' DWORD
    lpPhoneCaps As IntPtr   ' PHONECAPS* in/out
) As Integer
End Function
' hPhoneApp : DWORD
' dwDeviceID : DWORD
' dwAPIVersion : DWORD
' dwExtVersion : DWORD
' lpPhoneCaps : PHONECAPS* in/out
Declare PtrSafe Function phoneGetDevCapsW Lib "tapi32" ( _
    ByVal hPhoneApp As Long, _
    ByVal dwDeviceID As Long, _
    ByVal dwAPIVersion As Long, _
    ByVal dwExtVersion As Long, _
    ByVal lpPhoneCaps 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

phoneGetDevCapsW = ctypes.windll.tapi32.phoneGetDevCapsW
phoneGetDevCapsW.restype = ctypes.c_int
phoneGetDevCapsW.argtypes = [
    wintypes.DWORD,  # hPhoneApp : DWORD
    wintypes.DWORD,  # dwDeviceID : DWORD
    wintypes.DWORD,  # dwAPIVersion : DWORD
    wintypes.DWORD,  # dwExtVersion : DWORD
    ctypes.c_void_p,  # lpPhoneCaps : PHONECAPS* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	procphoneGetDevCapsW = tapi32.NewProc("phoneGetDevCapsW")
)

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