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

lineGenerateTone

関数
通話上に指定したトーン信号を生成して送出する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

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

INT lineGenerateTone(
    DWORD hCall,
    DWORD dwToneMode,
    DWORD dwDuration,
    DWORD dwNumTones,
    const LINEGENERATETONE* lpTones
);

パラメーター

名前方向
hCallDWORDin
dwToneModeDWORDin
dwDurationDWORDin
dwNumTonesDWORDin
lpTonesLINEGENERATETONE*in

戻り値の型: INT

各言語での呼び出し定義

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

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

lineGenerateTone = ctypes.windll.tapi32.lineGenerateTone
lineGenerateTone.restype = ctypes.c_int
lineGenerateTone.argtypes = [
    wintypes.DWORD,  # hCall : DWORD
    wintypes.DWORD,  # dwToneMode : DWORD
    wintypes.DWORD,  # dwDuration : DWORD
    wintypes.DWORD,  # dwNumTones : DWORD
    ctypes.c_void_p,  # lpTones : LINEGENERATETONE*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineGenerateTone = tapi32.NewProc("lineGenerateTone")
)

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