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

phoneSetGain

関数
電話のマイク入力のゲインを設定する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

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

INT phoneSetGain(
    DWORD hPhone,
    DWORD dwHookSwitchDev,
    DWORD dwGain
);

パラメーター

名前方向
hPhoneDWORDin
dwHookSwitchDevDWORDin
dwGainDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

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

phoneSetGain = ctypes.windll.tapi32.phoneSetGain
phoneSetGain.restype = ctypes.c_int
phoneSetGain.argtypes = [
    wintypes.DWORD,  # hPhone : DWORD
    wintypes.DWORD,  # dwHookSwitchDev : DWORD
    wintypes.DWORD,  # dwGain : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
phoneSetGain = Fiddle::Function.new(
  lib['phoneSetGain'],
  [
    -Fiddle::TYPE_INT,  # hPhone : DWORD
    -Fiddle::TYPE_INT,  # dwHookSwitchDev : DWORD
    -Fiddle::TYPE_INT,  # dwGain : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "tapi32")]
extern "system" {
    fn phoneSetGain(
        hPhone: u32,  // DWORD
        dwHookSwitchDev: u32,  // DWORD
        dwGain: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll")]
public static extern int phoneSetGain(uint hPhone, uint dwHookSwitchDev, uint dwGain);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_phoneSetGain' -Namespace Win32 -PassThru
# $api::phoneSetGain(hPhone, dwHookSwitchDev, dwGain)
#uselib "TAPI32.dll"
#func global phoneSetGain "phoneSetGain" sptr, sptr, sptr
; phoneSetGain hPhone, dwHookSwitchDev, dwGain   ; 戻り値は stat
; hPhone : DWORD -> "sptr"
; dwHookSwitchDev : DWORD -> "sptr"
; dwGain : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "TAPI32.dll"
#cfunc global phoneSetGain "phoneSetGain" int, int, int
; res = phoneSetGain(hPhone, dwHookSwitchDev, dwGain)
; hPhone : DWORD -> "int"
; dwHookSwitchDev : DWORD -> "int"
; dwGain : DWORD -> "int"
; INT phoneSetGain(DWORD hPhone, DWORD dwHookSwitchDev, DWORD dwGain)
#uselib "TAPI32.dll"
#cfunc global phoneSetGain "phoneSetGain" int, int, int
; res = phoneSetGain(hPhone, dwHookSwitchDev, dwGain)
; hPhone : DWORD -> "int"
; dwHookSwitchDev : DWORD -> "int"
; dwGain : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	procphoneSetGain = tapi32.NewProc("phoneSetGain")
)

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