ホーム › Devices.Tapi › tapiRequestMakeCallA
tapiRequestMakeCallA
関数発信を要求する関数のANSI版。
シグネチャ
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT tapiRequestMakeCallA(
LPCSTR lpszDestAddress,
LPCSTR lpszAppName,
LPCSTR lpszCalledParty,
LPCSTR lpszComment
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpszDestAddress | LPCSTR | in | 発信先のアドレス(電話番号)を示す文字列。 |
| lpszAppName | LPCSTR | in | 発信を要求するアプリケーション名を示す文字列。NULL可。 |
| lpszCalledParty | LPCSTR | in | 通話相手の名称を示す文字列。ログ表示用。NULL可。 |
| lpszComment | LPCSTR | in | 通話に付随するコメント文字列。NULL可。 |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT tapiRequestMakeCallA(
LPCSTR lpszDestAddress,
LPCSTR lpszAppName,
LPCSTR lpszCalledParty,
LPCSTR lpszComment
);[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int tapiRequestMakeCallA(
[MarshalAs(UnmanagedType.LPStr)] string lpszDestAddress, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string lpszAppName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string lpszCalledParty, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string lpszComment // LPCSTR
);<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function tapiRequestMakeCallA(
<MarshalAs(UnmanagedType.LPStr)> lpszDestAddress As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> lpszAppName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> lpszCalledParty As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> lpszComment As String ' LPCSTR
) As Integer
End Function' lpszDestAddress : LPCSTR
' lpszAppName : LPCSTR
' lpszCalledParty : LPCSTR
' lpszComment : LPCSTR
Declare PtrSafe Function tapiRequestMakeCallA Lib "tapi32" ( _
ByVal lpszDestAddress As String, _
ByVal lpszAppName As String, _
ByVal lpszCalledParty As String, _
ByVal lpszComment As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
tapiRequestMakeCallA = ctypes.windll.tapi32.tapiRequestMakeCallA
tapiRequestMakeCallA.restype = ctypes.c_int
tapiRequestMakeCallA.argtypes = [
wintypes.LPCSTR, # lpszDestAddress : LPCSTR
wintypes.LPCSTR, # lpszAppName : LPCSTR
wintypes.LPCSTR, # lpszCalledParty : LPCSTR
wintypes.LPCSTR, # lpszComment : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
tapiRequestMakeCallA = Fiddle::Function.new(
lib['tapiRequestMakeCallA'],
[
Fiddle::TYPE_VOIDP, # lpszDestAddress : LPCSTR
Fiddle::TYPE_VOIDP, # lpszAppName : LPCSTR
Fiddle::TYPE_VOIDP, # lpszCalledParty : LPCSTR
Fiddle::TYPE_VOIDP, # lpszComment : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "tapi32")]
extern "system" {
fn tapiRequestMakeCallA(
lpszDestAddress: *const u8, // LPCSTR
lpszAppName: *const u8, // LPCSTR
lpszCalledParty: *const u8, // LPCSTR
lpszComment: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi)]
public static extern int tapiRequestMakeCallA([MarshalAs(UnmanagedType.LPStr)] string lpszDestAddress, [MarshalAs(UnmanagedType.LPStr)] string lpszAppName, [MarshalAs(UnmanagedType.LPStr)] string lpszCalledParty, [MarshalAs(UnmanagedType.LPStr)] string lpszComment);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_tapiRequestMakeCallA' -Namespace Win32 -PassThru
# $api::tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)#uselib "TAPI32.dll"
#func global tapiRequestMakeCallA "tapiRequestMakeCallA" sptr, sptr, sptr, sptr
; tapiRequestMakeCallA lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment ; 戻り値は stat
; lpszDestAddress : LPCSTR -> "sptr"
; lpszAppName : LPCSTR -> "sptr"
; lpszCalledParty : LPCSTR -> "sptr"
; lpszComment : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "TAPI32.dll"
#cfunc global tapiRequestMakeCallA "tapiRequestMakeCallA" str, str, str, str
; res = tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
; lpszDestAddress : LPCSTR -> "str"
; lpszAppName : LPCSTR -> "str"
; lpszCalledParty : LPCSTR -> "str"
; lpszComment : LPCSTR -> "str"; INT tapiRequestMakeCallA(LPCSTR lpszDestAddress, LPCSTR lpszAppName, LPCSTR lpszCalledParty, LPCSTR lpszComment)
#uselib "TAPI32.dll"
#cfunc global tapiRequestMakeCallA "tapiRequestMakeCallA" str, str, str, str
; res = tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
; lpszDestAddress : LPCSTR -> "str"
; lpszAppName : LPCSTR -> "str"
; lpszCalledParty : LPCSTR -> "str"
; lpszComment : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
proctapiRequestMakeCallA = tapi32.NewProc("tapiRequestMakeCallA")
)
// lpszDestAddress (LPCSTR), lpszAppName (LPCSTR), lpszCalledParty (LPCSTR), lpszComment (LPCSTR)
r1, _, err := proctapiRequestMakeCallA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszDestAddress))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszAppName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszCalledParty))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszComment))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction tapiRequestMakeCallA(
lpszDestAddress: PAnsiChar; // LPCSTR
lpszAppName: PAnsiChar; // LPCSTR
lpszCalledParty: PAnsiChar; // LPCSTR
lpszComment: PAnsiChar // LPCSTR
): Integer; stdcall;
external 'TAPI32.dll' name 'tapiRequestMakeCallA';result := DllCall("TAPI32\tapiRequestMakeCallA"
, "AStr", lpszDestAddress ; LPCSTR
, "AStr", lpszAppName ; LPCSTR
, "AStr", lpszCalledParty ; LPCSTR
, "AStr", lpszComment ; LPCSTR
, "Int") ; return: INT●tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment) = DLL("TAPI32.dll", "int tapiRequestMakeCallA(char*, char*, char*, char*)")
# 呼び出し: tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
# lpszDestAddress : LPCSTR -> "char*"
# lpszAppName : LPCSTR -> "char*"
# lpszCalledParty : LPCSTR -> "char*"
# lpszComment : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "tapi32" fn tapiRequestMakeCallA(
lpszDestAddress: [*c]const u8, // LPCSTR
lpszAppName: [*c]const u8, // LPCSTR
lpszCalledParty: [*c]const u8, // LPCSTR
lpszComment: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) i32;proc tapiRequestMakeCallA(
lpszDestAddress: cstring, # LPCSTR
lpszAppName: cstring, # LPCSTR
lpszCalledParty: cstring, # LPCSTR
lpszComment: cstring # LPCSTR
): int32 {.importc: "tapiRequestMakeCallA", stdcall, dynlib: "TAPI32.dll".}pragma(lib, "tapi32");
extern(Windows)
int tapiRequestMakeCallA(
const(char)* lpszDestAddress, // LPCSTR
const(char)* lpszAppName, // LPCSTR
const(char)* lpszCalledParty, // LPCSTR
const(char)* lpszComment // LPCSTR
);ccall((:tapiRequestMakeCallA, "TAPI32.dll"), stdcall, Int32,
(Cstring, Cstring, Cstring, Cstring),
lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
# lpszDestAddress : LPCSTR -> Cstring
# lpszAppName : LPCSTR -> Cstring
# lpszCalledParty : LPCSTR -> Cstring
# lpszComment : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t tapiRequestMakeCallA(
const char* lpszDestAddress,
const char* lpszAppName,
const char* lpszCalledParty,
const char* lpszComment);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
-- lpszDestAddress : LPCSTR
-- lpszAppName : LPCSTR
-- lpszCalledParty : LPCSTR
-- lpszComment : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const tapiRequestMakeCallA = lib.func('__stdcall', 'tapiRequestMakeCallA', 'int32_t', ['str', 'str', 'str', 'str']);
// tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
// lpszDestAddress : LPCSTR -> 'str'
// lpszAppName : LPCSTR -> 'str'
// lpszCalledParty : LPCSTR -> 'str'
// lpszComment : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("TAPI32.dll", {
tapiRequestMakeCallA: { parameters: ["buffer", "buffer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment)
// lpszDestAddress : LPCSTR -> "buffer"
// lpszAppName : LPCSTR -> "buffer"
// lpszCalledParty : LPCSTR -> "buffer"
// lpszComment : LPCSTR -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t tapiRequestMakeCallA(
const char* lpszDestAddress,
const char* lpszAppName,
const char* lpszCalledParty,
const char* lpszComment);
C, "TAPI32.dll");
// $ffi->tapiRequestMakeCallA(lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment);
// lpszDestAddress : LPCSTR
// lpszAppName : LPCSTR
// lpszCalledParty : LPCSTR
// lpszComment : LPCSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Tapi32 extends StdCallLibrary {
Tapi32 INSTANCE = Native.load("tapi32", Tapi32.class, W32APIOptions.ASCII_OPTIONS);
int tapiRequestMakeCallA(
String lpszDestAddress, // LPCSTR
String lpszAppName, // LPCSTR
String lpszCalledParty, // LPCSTR
String lpszComment // LPCSTR
);
}@[Link("tapi32")]
lib LibTAPI32
fun tapiRequestMakeCallA = tapiRequestMakeCallA(
lpszDestAddress : UInt8*, # LPCSTR
lpszAppName : UInt8*, # LPCSTR
lpszCalledParty : UInt8*, # LPCSTR
lpszComment : UInt8* # LPCSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef tapiRequestMakeCallANative = Int32 Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
typedef tapiRequestMakeCallADart = int Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Utf8>);
final tapiRequestMakeCallA = DynamicLibrary.open('TAPI32.dll')
.lookupFunction<tapiRequestMakeCallANative, tapiRequestMakeCallADart>('tapiRequestMakeCallA');
// lpszDestAddress : LPCSTR -> Pointer<Utf8>
// lpszAppName : LPCSTR -> Pointer<Utf8>
// lpszCalledParty : LPCSTR -> Pointer<Utf8>
// lpszComment : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function tapiRequestMakeCallA(
lpszDestAddress: PAnsiChar; // LPCSTR
lpszAppName: PAnsiChar; // LPCSTR
lpszCalledParty: PAnsiChar; // LPCSTR
lpszComment: PAnsiChar // LPCSTR
): Integer; stdcall;
external 'TAPI32.dll' name 'tapiRequestMakeCallA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "tapiRequestMakeCallA"
c_tapiRequestMakeCallA :: CString -> CString -> CString -> CString -> IO Int32
-- lpszDestAddress : LPCSTR -> CString
-- lpszAppName : LPCSTR -> CString
-- lpszCalledParty : LPCSTR -> CString
-- lpszComment : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let tapirequestmakecalla =
foreign "tapiRequestMakeCallA"
(string @-> string @-> string @-> string @-> returning int32_t)
(* lpszDestAddress : LPCSTR -> string *)
(* lpszAppName : LPCSTR -> string *)
(* lpszCalledParty : LPCSTR -> string *)
(* lpszComment : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library tapi32 (t "TAPI32.dll"))
(cffi:use-foreign-library tapi32)
(cffi:defcfun ("tapiRequestMakeCallA" tapi-request-make-call-a :convention :stdcall) :int32
(lpsz-dest-address :string) ; LPCSTR
(lpsz-app-name :string) ; LPCSTR
(lpsz-called-party :string) ; LPCSTR
(lpsz-comment :string)) ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $tapiRequestMakeCallA = Win32::API::More->new('TAPI32',
'int tapiRequestMakeCallA(LPCSTR lpszDestAddress, LPCSTR lpszAppName, LPCSTR lpszCalledParty, LPCSTR lpszComment)');
# my $ret = $tapiRequestMakeCallA->Call($lpszDestAddress, $lpszAppName, $lpszCalledParty, $lpszComment);
# lpszDestAddress : LPCSTR -> LPCSTR
# lpszAppName : LPCSTR -> LPCSTR
# lpszCalledParty : LPCSTR -> LPCSTR
# lpszComment : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f tapiRequestMakeCallW (Unicode版) — 発信を要求する関数のUnicode版。