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

SendToFaxRecipient

関数
指定したファイルをファクス送信ウィザードで宛先へ送信する。
DLLfxsutility.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD SendToFaxRecipient(
    SendToMode sndMode,
    LPCWSTR lpFileName
);

パラメーター

名前方向説明
sndModeSendToModein送信モードをSendToMode列挙で指定する。受信者選択UIの表示方法等を決める。
lpFileNameLPCWSTRin送信する対象ファイルのパス(Unicode)を指定する。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD SendToFaxRecipient(
    SendToMode sndMode,
    LPCWSTR lpFileName
);
[DllImport("fxsutility.dll", ExactSpelling = true)]
static extern uint SendToFaxRecipient(
    int sndMode,   // SendToMode
    [MarshalAs(UnmanagedType.LPWStr)] string lpFileName   // LPCWSTR
);
<DllImport("fxsutility.dll", ExactSpelling:=True)>
Public Shared Function SendToFaxRecipient(
    sndMode As Integer,   ' SendToMode
    <MarshalAs(UnmanagedType.LPWStr)> lpFileName As String   ' LPCWSTR
) As UInteger
End Function
' sndMode : SendToMode
' lpFileName : LPCWSTR
Declare PtrSafe Function SendToFaxRecipient Lib "fxsutility" ( _
    ByVal sndMode As Long, _
    ByVal lpFileName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SendToFaxRecipient = ctypes.windll.fxsutility.SendToFaxRecipient
SendToFaxRecipient.restype = wintypes.DWORD
SendToFaxRecipient.argtypes = [
    ctypes.c_int,  # sndMode : SendToMode
    wintypes.LPCWSTR,  # lpFileName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('fxsutility.dll')
SendToFaxRecipient = Fiddle::Function.new(
  lib['SendToFaxRecipient'],
  [
    Fiddle::TYPE_INT,  # sndMode : SendToMode
    Fiddle::TYPE_VOIDP,  # lpFileName : LPCWSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "fxsutility")]
extern "system" {
    fn SendToFaxRecipient(
        sndMode: i32,  // SendToMode
        lpFileName: *const u16  // LPCWSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("fxsutility.dll")]
public static extern uint SendToFaxRecipient(int sndMode, [MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'fxsutility_SendToFaxRecipient' -Namespace Win32 -PassThru
# $api::SendToFaxRecipient(sndMode, lpFileName)
#uselib "fxsutility.dll"
#func global SendToFaxRecipient "SendToFaxRecipient" sptr, sptr
; SendToFaxRecipient sndMode, lpFileName   ; 戻り値は stat
; sndMode : SendToMode -> "sptr"
; lpFileName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "fxsutility.dll"
#cfunc global SendToFaxRecipient "SendToFaxRecipient" int, wstr
; res = SendToFaxRecipient(sndMode, lpFileName)
; sndMode : SendToMode -> "int"
; lpFileName : LPCWSTR -> "wstr"
; DWORD SendToFaxRecipient(SendToMode sndMode, LPCWSTR lpFileName)
#uselib "fxsutility.dll"
#cfunc global SendToFaxRecipient "SendToFaxRecipient" int, wstr
; res = SendToFaxRecipient(sndMode, lpFileName)
; sndMode : SendToMode -> "int"
; lpFileName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	fxsutility = windows.NewLazySystemDLL("fxsutility.dll")
	procSendToFaxRecipient = fxsutility.NewProc("SendToFaxRecipient")
)

// sndMode (SendToMode), lpFileName (LPCWSTR)
r1, _, err := procSendToFaxRecipient.Call(
	uintptr(sndMode),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpFileName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SendToFaxRecipient(
  sndMode: Integer;   // SendToMode
  lpFileName: PWideChar   // LPCWSTR
): DWORD; stdcall;
  external 'fxsutility.dll' name 'SendToFaxRecipient';
result := DllCall("fxsutility\SendToFaxRecipient"
    , "Int", sndMode   ; SendToMode
    , "WStr", lpFileName   ; LPCWSTR
    , "UInt")   ; return: DWORD
●SendToFaxRecipient(sndMode, lpFileName) = DLL("fxsutility.dll", "dword SendToFaxRecipient(int, char*)")
# 呼び出し: SendToFaxRecipient(sndMode, lpFileName)
# sndMode : SendToMode -> "int"
# lpFileName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "fxsutility" fn SendToFaxRecipient(
    sndMode: i32, // SendToMode
    lpFileName: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) u32;
proc SendToFaxRecipient(
    sndMode: int32,  # SendToMode
    lpFileName: WideCString  # LPCWSTR
): uint32 {.importc: "SendToFaxRecipient", stdcall, dynlib: "fxsutility.dll".}
pragma(lib, "fxsutility");
extern(Windows)
uint SendToFaxRecipient(
    int sndMode,   // SendToMode
    const(wchar)* lpFileName   // LPCWSTR
);
ccall((:SendToFaxRecipient, "fxsutility.dll"), stdcall, UInt32,
      (Int32, Cwstring),
      sndMode, lpFileName)
# sndMode : SendToMode -> Int32
# lpFileName : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t SendToFaxRecipient(
    int32_t sndMode,
    const uint16_t* lpFileName);
]]
local fxsutility = ffi.load("fxsutility")
-- fxsutility.SendToFaxRecipient(sndMode, lpFileName)
-- sndMode : SendToMode
-- lpFileName : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('fxsutility.dll');
const SendToFaxRecipient = lib.func('__stdcall', 'SendToFaxRecipient', 'uint32_t', ['int32_t', 'str16']);
// SendToFaxRecipient(sndMode, lpFileName)
// sndMode : SendToMode -> 'int32_t'
// lpFileName : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("fxsutility.dll", {
  SendToFaxRecipient: { parameters: ["i32", "buffer"], result: "u32" },
});
// lib.symbols.SendToFaxRecipient(sndMode, lpFileName)
// sndMode : SendToMode -> "i32"
// lpFileName : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t SendToFaxRecipient(
    int32_t sndMode,
    const uint16_t* lpFileName);
C, "fxsutility.dll");
// $ffi->SendToFaxRecipient(sndMode, lpFileName);
// sndMode : SendToMode
// lpFileName : 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 Fxsutility extends StdCallLibrary {
    Fxsutility INSTANCE = Native.load("fxsutility", Fxsutility.class);
    int SendToFaxRecipient(
        int sndMode,   // SendToMode
        WString lpFileName   // LPCWSTR
    );
}
@[Link("fxsutility")]
lib Libfxsutility
  fun SendToFaxRecipient = SendToFaxRecipient(
    sndMode : Int32,   # SendToMode
    lpFileName : UInt16*   # LPCWSTR
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SendToFaxRecipientNative = Uint32 Function(Int32, Pointer<Utf16>);
typedef SendToFaxRecipientDart = int Function(int, Pointer<Utf16>);
final SendToFaxRecipient = DynamicLibrary.open('fxsutility.dll')
    .lookupFunction<SendToFaxRecipientNative, SendToFaxRecipientDart>('SendToFaxRecipient');
// sndMode : SendToMode -> Int32
// lpFileName : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SendToFaxRecipient(
  sndMode: Integer;   // SendToMode
  lpFileName: PWideChar   // LPCWSTR
): DWORD; stdcall;
  external 'fxsutility.dll' name 'SendToFaxRecipient';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SendToFaxRecipient"
  c_SendToFaxRecipient :: Int32 -> CWString -> IO Word32
-- sndMode : SendToMode -> Int32
-- lpFileName : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let sendtofaxrecipient =
  foreign "SendToFaxRecipient"
    (int32_t @-> (ptr uint16_t) @-> returning uint32_t)
(* sndMode : SendToMode -> int32_t *)
(* lpFileName : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library fxsutility (t "fxsutility.dll"))
(cffi:use-foreign-library fxsutility)

(cffi:defcfun ("SendToFaxRecipient" send-to-fax-recipient :convention :stdcall) :uint32
  (snd-mode :int32)   ; SendToMode
  (lp-file-name (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SendToFaxRecipient = Win32::API::More->new('fxsutility',
    'DWORD SendToFaxRecipient(int sndMode, LPCWSTR lpFileName)');
# my $ret = $SendToFaxRecipient->Call($sndMode, $lpFileName);
# sndMode : SendToMode -> int
# lpFileName : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型