ホーム › Devices.Tapi › phoneOpen
phoneOpen
関数指定した電話デバイスを開いてハンドルを取得する。
シグネチャ
// TAPI32.dll
#include <windows.h>
INT phoneOpen(
DWORD hPhoneApp,
DWORD dwDeviceID,
DWORD* lphPhone,
DWORD dwAPIVersion,
DWORD dwExtVersion,
UINT_PTR dwCallbackInstance,
DWORD dwPrivilege
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hPhoneApp | DWORD | in |
| dwDeviceID | DWORD | in |
| lphPhone | DWORD* | inout |
| dwAPIVersion | DWORD | in |
| dwExtVersion | DWORD | in |
| dwCallbackInstance | UINT_PTR | in |
| dwPrivilege | DWORD | in |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll
#include <windows.h>
INT phoneOpen(
DWORD hPhoneApp,
DWORD dwDeviceID,
DWORD* lphPhone,
DWORD dwAPIVersion,
DWORD dwExtVersion,
UINT_PTR dwCallbackInstance,
DWORD dwPrivilege
);[DllImport("TAPI32.dll", ExactSpelling = true)]
static extern int phoneOpen(
uint hPhoneApp, // DWORD
uint dwDeviceID, // DWORD
ref uint lphPhone, // DWORD* in/out
uint dwAPIVersion, // DWORD
uint dwExtVersion, // DWORD
UIntPtr dwCallbackInstance, // UINT_PTR
uint dwPrivilege // DWORD
);<DllImport("TAPI32.dll", ExactSpelling:=True)>
Public Shared Function phoneOpen(
hPhoneApp As UInteger, ' DWORD
dwDeviceID As UInteger, ' DWORD
ByRef lphPhone As UInteger, ' DWORD* in/out
dwAPIVersion As UInteger, ' DWORD
dwExtVersion As UInteger, ' DWORD
dwCallbackInstance As UIntPtr, ' UINT_PTR
dwPrivilege As UInteger ' DWORD
) As Integer
End Function' hPhoneApp : DWORD
' dwDeviceID : DWORD
' lphPhone : DWORD* in/out
' dwAPIVersion : DWORD
' dwExtVersion : DWORD
' dwCallbackInstance : UINT_PTR
' dwPrivilege : DWORD
Declare PtrSafe Function phoneOpen Lib "tapi32" ( _
ByVal hPhoneApp As Long, _
ByVal dwDeviceID As Long, _
ByRef lphPhone As Long, _
ByVal dwAPIVersion As Long, _
ByVal dwExtVersion As Long, _
ByVal dwCallbackInstance As LongPtr, _
ByVal dwPrivilege As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
phoneOpen = ctypes.windll.tapi32.phoneOpen
phoneOpen.restype = ctypes.c_int
phoneOpen.argtypes = [
wintypes.DWORD, # hPhoneApp : DWORD
wintypes.DWORD, # dwDeviceID : DWORD
ctypes.POINTER(wintypes.DWORD), # lphPhone : DWORD* in/out
wintypes.DWORD, # dwAPIVersion : DWORD
wintypes.DWORD, # dwExtVersion : DWORD
ctypes.c_size_t, # dwCallbackInstance : UINT_PTR
wintypes.DWORD, # dwPrivilege : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
phoneOpen = Fiddle::Function.new(
lib['phoneOpen'],
[
-Fiddle::TYPE_INT, # hPhoneApp : DWORD
-Fiddle::TYPE_INT, # dwDeviceID : DWORD
Fiddle::TYPE_VOIDP, # lphPhone : DWORD* in/out
-Fiddle::TYPE_INT, # dwAPIVersion : DWORD
-Fiddle::TYPE_INT, # dwExtVersion : DWORD
Fiddle::TYPE_UINTPTR_T, # dwCallbackInstance : UINT_PTR
-Fiddle::TYPE_INT, # dwPrivilege : DWORD
],
Fiddle::TYPE_INT)#[link(name = "tapi32")]
extern "system" {
fn phoneOpen(
hPhoneApp: u32, // DWORD
dwDeviceID: u32, // DWORD
lphPhone: *mut u32, // DWORD* in/out
dwAPIVersion: u32, // DWORD
dwExtVersion: u32, // DWORD
dwCallbackInstance: usize, // UINT_PTR
dwPrivilege: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("TAPI32.dll")]
public static extern int phoneOpen(uint hPhoneApp, uint dwDeviceID, ref uint lphPhone, uint dwAPIVersion, uint dwExtVersion, UIntPtr dwCallbackInstance, uint dwPrivilege);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_phoneOpen' -Namespace Win32 -PassThru
# $api::phoneOpen(hPhoneApp, dwDeviceID, lphPhone, dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege)#uselib "TAPI32.dll"
#func global phoneOpen "phoneOpen" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; phoneOpen hPhoneApp, dwDeviceID, varptr(lphPhone), dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege ; 戻り値は stat
; hPhoneApp : DWORD -> "sptr"
; dwDeviceID : DWORD -> "sptr"
; lphPhone : DWORD* in/out -> "sptr"
; dwAPIVersion : DWORD -> "sptr"
; dwExtVersion : DWORD -> "sptr"
; dwCallbackInstance : UINT_PTR -> "sptr"
; dwPrivilege : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global phoneOpen "phoneOpen" int, int, var, int, int, sptr, int ; res = phoneOpen(hPhoneApp, dwDeviceID, lphPhone, dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege) ; hPhoneApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; lphPhone : DWORD* in/out -> "var" ; dwAPIVersion : DWORD -> "int" ; dwExtVersion : DWORD -> "int" ; dwCallbackInstance : UINT_PTR -> "sptr" ; dwPrivilege : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "TAPI32.dll" #cfunc global phoneOpen "phoneOpen" int, int, sptr, int, int, sptr, int ; res = phoneOpen(hPhoneApp, dwDeviceID, varptr(lphPhone), dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege) ; hPhoneApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; lphPhone : DWORD* in/out -> "sptr" ; dwAPIVersion : DWORD -> "int" ; dwExtVersion : DWORD -> "int" ; dwCallbackInstance : UINT_PTR -> "sptr" ; dwPrivilege : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT phoneOpen(DWORD hPhoneApp, DWORD dwDeviceID, DWORD* lphPhone, DWORD dwAPIVersion, DWORD dwExtVersion, UINT_PTR dwCallbackInstance, DWORD dwPrivilege) #uselib "TAPI32.dll" #cfunc global phoneOpen "phoneOpen" int, int, var, int, int, intptr, int ; res = phoneOpen(hPhoneApp, dwDeviceID, lphPhone, dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege) ; hPhoneApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; lphPhone : DWORD* in/out -> "var" ; dwAPIVersion : DWORD -> "int" ; dwExtVersion : DWORD -> "int" ; dwCallbackInstance : UINT_PTR -> "intptr" ; dwPrivilege : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT phoneOpen(DWORD hPhoneApp, DWORD dwDeviceID, DWORD* lphPhone, DWORD dwAPIVersion, DWORD dwExtVersion, UINT_PTR dwCallbackInstance, DWORD dwPrivilege) #uselib "TAPI32.dll" #cfunc global phoneOpen "phoneOpen" int, int, intptr, int, int, intptr, int ; res = phoneOpen(hPhoneApp, dwDeviceID, varptr(lphPhone), dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege) ; hPhoneApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; lphPhone : DWORD* in/out -> "intptr" ; dwAPIVersion : DWORD -> "int" ; dwExtVersion : DWORD -> "int" ; dwCallbackInstance : UINT_PTR -> "intptr" ; dwPrivilege : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
procphoneOpen = tapi32.NewProc("phoneOpen")
)
// hPhoneApp (DWORD), dwDeviceID (DWORD), lphPhone (DWORD* in/out), dwAPIVersion (DWORD), dwExtVersion (DWORD), dwCallbackInstance (UINT_PTR), dwPrivilege (DWORD)
r1, _, err := procphoneOpen.Call(
uintptr(hPhoneApp),
uintptr(dwDeviceID),
uintptr(lphPhone),
uintptr(dwAPIVersion),
uintptr(dwExtVersion),
uintptr(dwCallbackInstance),
uintptr(dwPrivilege),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction phoneOpen(
hPhoneApp: DWORD; // DWORD
dwDeviceID: DWORD; // DWORD
lphPhone: Pointer; // DWORD* in/out
dwAPIVersion: DWORD; // DWORD
dwExtVersion: DWORD; // DWORD
dwCallbackInstance: NativeUInt; // UINT_PTR
dwPrivilege: DWORD // DWORD
): Integer; stdcall;
external 'TAPI32.dll' name 'phoneOpen';result := DllCall("TAPI32\phoneOpen"
, "UInt", hPhoneApp ; DWORD
, "UInt", dwDeviceID ; DWORD
, "Ptr", lphPhone ; DWORD* in/out
, "UInt", dwAPIVersion ; DWORD
, "UInt", dwExtVersion ; DWORD
, "UPtr", dwCallbackInstance ; UINT_PTR
, "UInt", dwPrivilege ; DWORD
, "Int") ; return: INT●phoneOpen(hPhoneApp, dwDeviceID, lphPhone, dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege) = DLL("TAPI32.dll", "int phoneOpen(dword, dword, void*, dword, dword, int, dword)")
# 呼び出し: phoneOpen(hPhoneApp, dwDeviceID, lphPhone, dwAPIVersion, dwExtVersion, dwCallbackInstance, dwPrivilege)
# hPhoneApp : DWORD -> "dword"
# dwDeviceID : DWORD -> "dword"
# lphPhone : DWORD* in/out -> "void*"
# dwAPIVersion : DWORD -> "dword"
# dwExtVersion : DWORD -> "dword"
# dwCallbackInstance : UINT_PTR -> "int"
# dwPrivilege : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。