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

phoneGetRing

関数
電話の現在の呼び出しモードと音量を取得する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

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

INT phoneGetRing(
    DWORD hPhone,
    DWORD* lpdwRingMode,
    DWORD* lpdwVolume
);

パラメーター

名前方向
hPhoneDWORDin
lpdwRingModeDWORD*inout
lpdwVolumeDWORD*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

phoneGetRing = ctypes.windll.tapi32.phoneGetRing
phoneGetRing.restype = ctypes.c_int
phoneGetRing.argtypes = [
    wintypes.DWORD,  # hPhone : DWORD
    ctypes.POINTER(wintypes.DWORD),  # lpdwRingMode : DWORD* in/out
    ctypes.POINTER(wintypes.DWORD),  # lpdwVolume : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	procphoneGetRing = tapi32.NewProc("phoneGetRing")
)

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