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

SendToFaxRecipient

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

シグネチャ

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

DWORD SendToFaxRecipient(
    SendToMode sndMode,
    LPCWSTR lpFileName
);

パラメーター

名前方向
sndModeSendToModein
lpFileNameLPCWSTRin

戻り値の型: 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)。