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