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

phoneGetStatus

関数
電話デバイスの現在のステータスを取得する。
DLLTAPI32.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// TAPI32.dll  (ANSI / -A)
#include <windows.h>

INT phoneGetStatus(
    DWORD hPhone,
    PHONESTATUS* lpPhoneStatus
);

パラメーター

名前方向
hPhoneDWORDin
lpPhoneStatusPHONESTATUS*inout

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll  (ANSI / -A)
#include <windows.h>

INT phoneGetStatus(
    DWORD hPhone,
    PHONESTATUS* lpPhoneStatus
);
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int phoneGetStatus(
    uint hPhone,   // DWORD
    IntPtr lpPhoneStatus   // PHONESTATUS* in/out
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function phoneGetStatus(
    hPhone As UInteger,   ' DWORD
    lpPhoneStatus As IntPtr   ' PHONESTATUS* in/out
) As Integer
End Function
' hPhone : DWORD
' lpPhoneStatus : PHONESTATUS* in/out
Declare PtrSafe Function phoneGetStatus Lib "tapi32" ( _
    ByVal hPhone As Long, _
    ByVal lpPhoneStatus As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

phoneGetStatus = ctypes.windll.tapi32.phoneGetStatus
phoneGetStatus.restype = ctypes.c_int
phoneGetStatus.argtypes = [
    wintypes.DWORD,  # hPhone : DWORD
    ctypes.c_void_p,  # lpPhoneStatus : PHONESTATUS* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	procphoneGetStatus = tapi32.NewProc("phoneGetStatus")
)

// hPhone (DWORD), lpPhoneStatus (PHONESTATUS* in/out)
r1, _, err := procphoneGetStatus.Call(
	uintptr(hPhone),
	uintptr(lpPhoneStatus),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function phoneGetStatus(
  hPhone: DWORD;   // DWORD
  lpPhoneStatus: Pointer   // PHONESTATUS* in/out
): Integer; stdcall;
  external 'TAPI32.dll' name 'phoneGetStatus';
result := DllCall("TAPI32\phoneGetStatus"
    , "UInt", hPhone   ; DWORD
    , "Ptr", lpPhoneStatus   ; PHONESTATUS* in/out
    , "Int")   ; return: INT
●phoneGetStatus(hPhone, lpPhoneStatus) = DLL("TAPI32.dll", "int phoneGetStatus(dword, void*)")
# 呼び出し: phoneGetStatus(hPhone, lpPhoneStatus)
# hPhone : DWORD -> "dword"
# lpPhoneStatus : PHONESTATUS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。