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