ホーム › Devices.Fax › FaxSendDocumentForBroadcastA
FaxSendDocumentForBroadcastA
関数同報送信用にファクス文書を複数宛先へ一括送信する。
シグネチャ
// WINFAX.dll (ANSI / -A)
#include <windows.h>
BOOL FaxSendDocumentForBroadcastA(
HANDLE FaxHandle,
LPCSTR FileName,
DWORD* FaxJobId,
PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback,
void* Context
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| FaxHandle | HANDLE | in | FAXサーバー接続のハンドルを指定する。 |
| FileName | LPCSTR | in | 送信する文書ファイルのパス(ANSI)を指定する。複数宛先への一斉送信に使う。 |
| FaxJobId | DWORD* | out | 作成された送信ジョブのIDを受け取るDWORDへのポインタを指定する。出力専用。 |
| FaxRecipientCallback | PFAX_RECIPIENT_CALLBACKA | in | 各受信者のジョブ情報を提供するコールバック関数(ANSI)へのポインタを指定する。 |
| Context | void* | in | コールバックに渡す任意のコンテキストポインタを指定する。NULL可。 |
戻り値の型: BOOL
各言語での呼び出し定義
// WINFAX.dll (ANSI / -A)
#include <windows.h>
BOOL FaxSendDocumentForBroadcastA(
HANDLE FaxHandle,
LPCSTR FileName,
DWORD* FaxJobId,
PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback,
void* Context
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool FaxSendDocumentForBroadcastA(
IntPtr FaxHandle, // HANDLE
[MarshalAs(UnmanagedType.LPStr)] string FileName, // LPCSTR
out uint FaxJobId, // DWORD* out
IntPtr FaxRecipientCallback, // PFAX_RECIPIENT_CALLBACKA
IntPtr Context // void*
);<DllImport("WINFAX.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FaxSendDocumentForBroadcastA(
FaxHandle As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPStr)> FileName As String, ' LPCSTR
<Out> ByRef FaxJobId As UInteger, ' DWORD* out
FaxRecipientCallback As IntPtr, ' PFAX_RECIPIENT_CALLBACKA
Context As IntPtr ' void*
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' FaxHandle : HANDLE
' FileName : LPCSTR
' FaxJobId : DWORD* out
' FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA
' Context : void*
Declare PtrSafe Function FaxSendDocumentForBroadcastA Lib "winfax" ( _
ByVal FaxHandle As LongPtr, _
ByVal FileName As String, _
ByRef FaxJobId As Long, _
ByVal FaxRecipientCallback As LongPtr, _
ByVal Context As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FaxSendDocumentForBroadcastA = ctypes.windll.winfax.FaxSendDocumentForBroadcastA
FaxSendDocumentForBroadcastA.restype = wintypes.BOOL
FaxSendDocumentForBroadcastA.argtypes = [
wintypes.HANDLE, # FaxHandle : HANDLE
wintypes.LPCSTR, # FileName : LPCSTR
ctypes.POINTER(wintypes.DWORD), # FaxJobId : DWORD* out
ctypes.c_void_p, # FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA
ctypes.POINTER(None), # Context : void*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINFAX.dll')
FaxSendDocumentForBroadcastA = Fiddle::Function.new(
lib['FaxSendDocumentForBroadcastA'],
[
Fiddle::TYPE_VOIDP, # FaxHandle : HANDLE
Fiddle::TYPE_VOIDP, # FileName : LPCSTR
Fiddle::TYPE_VOIDP, # FaxJobId : DWORD* out
Fiddle::TYPE_VOIDP, # FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA
Fiddle::TYPE_VOIDP, # Context : void*
],
Fiddle::TYPE_INT)#[link(name = "winfax")]
extern "system" {
fn FaxSendDocumentForBroadcastA(
FaxHandle: *mut core::ffi::c_void, // HANDLE
FileName: *const u8, // LPCSTR
FaxJobId: *mut u32, // DWORD* out
FaxRecipientCallback: *const core::ffi::c_void, // PFAX_RECIPIENT_CALLBACKA
Context: *mut () // void*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool FaxSendDocumentForBroadcastA(IntPtr FaxHandle, [MarshalAs(UnmanagedType.LPStr)] string FileName, out uint FaxJobId, IntPtr FaxRecipientCallback, IntPtr Context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINFAX_FaxSendDocumentForBroadcastA' -Namespace Win32 -PassThru
# $api::FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context)#uselib "WINFAX.dll"
#func global FaxSendDocumentForBroadcastA "FaxSendDocumentForBroadcastA" sptr, sptr, sptr, sptr, sptr
; FaxSendDocumentForBroadcastA FaxHandle, FileName, varptr(FaxJobId), FaxRecipientCallback, Context ; 戻り値は stat
; FaxHandle : HANDLE -> "sptr"
; FileName : LPCSTR -> "sptr"
; FaxJobId : DWORD* out -> "sptr"
; FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "sptr"
; Context : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINFAX.dll" #cfunc global FaxSendDocumentForBroadcastA "FaxSendDocumentForBroadcastA" sptr, str, var, sptr, sptr ; res = FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context) ; FaxHandle : HANDLE -> "sptr" ; FileName : LPCSTR -> "str" ; FaxJobId : DWORD* out -> "var" ; FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "sptr" ; Context : void* -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINFAX.dll" #cfunc global FaxSendDocumentForBroadcastA "FaxSendDocumentForBroadcastA" sptr, str, sptr, sptr, sptr ; res = FaxSendDocumentForBroadcastA(FaxHandle, FileName, varptr(FaxJobId), FaxRecipientCallback, Context) ; FaxHandle : HANDLE -> "sptr" ; FileName : LPCSTR -> "str" ; FaxJobId : DWORD* out -> "sptr" ; FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "sptr" ; Context : void* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL FaxSendDocumentForBroadcastA(HANDLE FaxHandle, LPCSTR FileName, DWORD* FaxJobId, PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback, void* Context) #uselib "WINFAX.dll" #cfunc global FaxSendDocumentForBroadcastA "FaxSendDocumentForBroadcastA" intptr, str, var, intptr, intptr ; res = FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context) ; FaxHandle : HANDLE -> "intptr" ; FileName : LPCSTR -> "str" ; FaxJobId : DWORD* out -> "var" ; FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "intptr" ; Context : void* -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL FaxSendDocumentForBroadcastA(HANDLE FaxHandle, LPCSTR FileName, DWORD* FaxJobId, PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback, void* Context) #uselib "WINFAX.dll" #cfunc global FaxSendDocumentForBroadcastA "FaxSendDocumentForBroadcastA" intptr, str, intptr, intptr, intptr ; res = FaxSendDocumentForBroadcastA(FaxHandle, FileName, varptr(FaxJobId), FaxRecipientCallback, Context) ; FaxHandle : HANDLE -> "intptr" ; FileName : LPCSTR -> "str" ; FaxJobId : DWORD* out -> "intptr" ; FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "intptr" ; Context : void* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winfax = windows.NewLazySystemDLL("WINFAX.dll")
procFaxSendDocumentForBroadcastA = winfax.NewProc("FaxSendDocumentForBroadcastA")
)
// FaxHandle (HANDLE), FileName (LPCSTR), FaxJobId (DWORD* out), FaxRecipientCallback (PFAX_RECIPIENT_CALLBACKA), Context (void*)
r1, _, err := procFaxSendDocumentForBroadcastA.Call(
uintptr(FaxHandle),
uintptr(unsafe.Pointer(windows.BytePtrFromString(FileName))),
uintptr(FaxJobId),
uintptr(FaxRecipientCallback),
uintptr(Context),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FaxSendDocumentForBroadcastA(
FaxHandle: THandle; // HANDLE
FileName: PAnsiChar; // LPCSTR
FaxJobId: Pointer; // DWORD* out
FaxRecipientCallback: Pointer; // PFAX_RECIPIENT_CALLBACKA
Context: Pointer // void*
): BOOL; stdcall;
external 'WINFAX.dll' name 'FaxSendDocumentForBroadcastA';result := DllCall("WINFAX\FaxSendDocumentForBroadcastA"
, "Ptr", FaxHandle ; HANDLE
, "AStr", FileName ; LPCSTR
, "Ptr", FaxJobId ; DWORD* out
, "Ptr", FaxRecipientCallback ; PFAX_RECIPIENT_CALLBACKA
, "Ptr", Context ; void*
, "Int") ; return: BOOL●FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context) = DLL("WINFAX.dll", "bool FaxSendDocumentForBroadcastA(void*, char*, void*, void*, void*)")
# 呼び出し: FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context)
# FaxHandle : HANDLE -> "void*"
# FileName : LPCSTR -> "char*"
# FaxJobId : DWORD* out -> "void*"
# FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "void*"
# Context : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "winfax" fn FaxSendDocumentForBroadcastA(
FaxHandle: ?*anyopaque, // HANDLE
FileName: [*c]const u8, // LPCSTR
FaxJobId: [*c]u32, // DWORD* out
FaxRecipientCallback: ?*anyopaque, // PFAX_RECIPIENT_CALLBACKA
Context: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) i32;proc FaxSendDocumentForBroadcastA(
FaxHandle: pointer, # HANDLE
FileName: cstring, # LPCSTR
FaxJobId: ptr uint32, # DWORD* out
FaxRecipientCallback: pointer, # PFAX_RECIPIENT_CALLBACKA
Context: pointer # void*
): int32 {.importc: "FaxSendDocumentForBroadcastA", stdcall, dynlib: "WINFAX.dll".}pragma(lib, "winfax");
extern(Windows)
int FaxSendDocumentForBroadcastA(
void* FaxHandle, // HANDLE
const(char)* FileName, // LPCSTR
uint* FaxJobId, // DWORD* out
void* FaxRecipientCallback, // PFAX_RECIPIENT_CALLBACKA
void* Context // void*
);ccall((:FaxSendDocumentForBroadcastA, "WINFAX.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cstring, Ptr{UInt32}, Ptr{Cvoid}, Ptr{Cvoid}),
FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context)
# FaxHandle : HANDLE -> Ptr{Cvoid}
# FileName : LPCSTR -> Cstring
# FaxJobId : DWORD* out -> Ptr{UInt32}
# FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> Ptr{Cvoid}
# Context : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t FaxSendDocumentForBroadcastA(
void* FaxHandle,
const char* FileName,
uint32_t* FaxJobId,
void* FaxRecipientCallback,
void* Context);
]]
local winfax = ffi.load("winfax")
-- winfax.FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context)
-- FaxHandle : HANDLE
-- FileName : LPCSTR
-- FaxJobId : DWORD* out
-- FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA
-- Context : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WINFAX.dll');
const FaxSendDocumentForBroadcastA = lib.func('__stdcall', 'FaxSendDocumentForBroadcastA', 'int32_t', ['void *', 'str', 'uint32_t *', 'void *', 'void *']);
// FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context)
// FaxHandle : HANDLE -> 'void *'
// FileName : LPCSTR -> 'str'
// FaxJobId : DWORD* out -> 'uint32_t *'
// FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> 'void *'
// Context : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("WINFAX.dll", {
FaxSendDocumentForBroadcastA: { parameters: ["pointer", "buffer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context)
// FaxHandle : HANDLE -> "pointer"
// FileName : LPCSTR -> "buffer"
// FaxJobId : DWORD* out -> "pointer"
// FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> "pointer"
// Context : void* -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t FaxSendDocumentForBroadcastA(
void* FaxHandle,
const char* FileName,
uint32_t* FaxJobId,
void* FaxRecipientCallback,
void* Context);
C, "WINFAX.dll");
// $ffi->FaxSendDocumentForBroadcastA(FaxHandle, FileName, FaxJobId, FaxRecipientCallback, Context);
// FaxHandle : HANDLE
// FileName : LPCSTR
// FaxJobId : DWORD* out
// FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA
// Context : void*
// 構造体/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 Winfax extends StdCallLibrary {
Winfax INSTANCE = Native.load("winfax", Winfax.class, W32APIOptions.ASCII_OPTIONS);
boolean FaxSendDocumentForBroadcastA(
Pointer FaxHandle, // HANDLE
String FileName, // LPCSTR
IntByReference FaxJobId, // DWORD* out
Callback FaxRecipientCallback, // PFAX_RECIPIENT_CALLBACKA
Pointer Context // void*
);
}@[Link("winfax")]
lib LibWINFAX
fun FaxSendDocumentForBroadcastA = FaxSendDocumentForBroadcastA(
FaxHandle : Void*, # HANDLE
FileName : UInt8*, # LPCSTR
FaxJobId : UInt32*, # DWORD* out
FaxRecipientCallback : Void*, # PFAX_RECIPIENT_CALLBACKA
Context : Void* # void*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FaxSendDocumentForBroadcastANative = Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Uint32>, Pointer<Void>, Pointer<Void>);
typedef FaxSendDocumentForBroadcastADart = int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Uint32>, Pointer<Void>, Pointer<Void>);
final FaxSendDocumentForBroadcastA = DynamicLibrary.open('WINFAX.dll')
.lookupFunction<FaxSendDocumentForBroadcastANative, FaxSendDocumentForBroadcastADart>('FaxSendDocumentForBroadcastA');
// FaxHandle : HANDLE -> Pointer<Void>
// FileName : LPCSTR -> Pointer<Utf8>
// FaxJobId : DWORD* out -> Pointer<Uint32>
// FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> Pointer<Void>
// Context : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FaxSendDocumentForBroadcastA(
FaxHandle: THandle; // HANDLE
FileName: PAnsiChar; // LPCSTR
FaxJobId: Pointer; // DWORD* out
FaxRecipientCallback: Pointer; // PFAX_RECIPIENT_CALLBACKA
Context: Pointer // void*
): BOOL; stdcall;
external 'WINFAX.dll' name 'FaxSendDocumentForBroadcastA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "FaxSendDocumentForBroadcastA"
c_FaxSendDocumentForBroadcastA :: Ptr () -> CString -> Ptr Word32 -> Ptr () -> Ptr () -> IO CInt
-- FaxHandle : HANDLE -> Ptr ()
-- FileName : LPCSTR -> CString
-- FaxJobId : DWORD* out -> Ptr Word32
-- FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> Ptr ()
-- Context : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let faxsenddocumentforbroadcasta =
foreign "FaxSendDocumentForBroadcastA"
((ptr void) @-> string @-> (ptr uint32_t) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* FaxHandle : HANDLE -> (ptr void) *)
(* FileName : LPCSTR -> string *)
(* FaxJobId : DWORD* out -> (ptr uint32_t) *)
(* FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> (ptr void) *)
(* Context : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library winfax (t "WINFAX.dll"))
(cffi:use-foreign-library winfax)
(cffi:defcfun ("FaxSendDocumentForBroadcastA" fax-send-document-for-broadcast-a :convention :stdcall) :int32
(fax-handle :pointer) ; HANDLE
(file-name :string) ; LPCSTR
(fax-job-id :pointer) ; DWORD* out
(fax-recipient-callback :pointer) ; PFAX_RECIPIENT_CALLBACKA
(context :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FaxSendDocumentForBroadcastA = Win32::API::More->new('WINFAX',
'BOOL FaxSendDocumentForBroadcastA(HANDLE FaxHandle, LPCSTR FileName, LPVOID FaxJobId, LPVOID FaxRecipientCallback, LPVOID Context)');
# my $ret = $FaxSendDocumentForBroadcastA->Call($FaxHandle, $FileName, $FaxJobId, $FaxRecipientCallback, $Context);
# FaxHandle : HANDLE -> HANDLE
# FileName : LPCSTR -> LPCSTR
# FaxJobId : DWORD* out -> LPVOID
# FaxRecipientCallback : PFAX_RECIPIENT_CALLBACKA -> LPVOID
# Context : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。関連項目
文字セット違い
- f FaxSendDocumentForBroadcastW (Unicode版) — 同報送信用にファクス文書を複数宛先へ一括送信する。