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

phoneGetDisplay

関数
電話のディスプレイに表示されている内容を取得する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

// TAPI32.dll
#include <windows.h>

INT phoneGetDisplay(
    DWORD hPhone,
    VARSTRING* lpDisplay
);

パラメーター

名前方向
hPhoneDWORDin
lpDisplayVARSTRING*inout

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll
#include <windows.h>

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

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

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	procphoneGetDisplay = tapi32.NewProc("phoneGetDisplay")
)

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