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

FaxRegisterRoutingExtensionW

関数
ファクスのルーティング拡張を登録する。
DLLWINFAX.dll呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

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

BOOL FaxRegisterRoutingExtensionW(
    HANDLE FaxHandle,
    LPCWSTR ExtensionName,
    LPCWSTR FriendlyName,
    LPCWSTR ImageName,
    PFAX_ROUTING_INSTALLATION_CALLBACKW CallBack,
    void* Context
);

パラメーター

名前方向
FaxHandleHANDLEin
ExtensionNameLPCWSTRin
FriendlyNameLPCWSTRin
ImageNameLPCWSTRin
CallBackPFAX_ROUTING_INSTALLATION_CALLBACKWin
Contextvoid*in

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL FaxRegisterRoutingExtensionW(
    HANDLE FaxHandle,
    LPCWSTR ExtensionName,
    LPCWSTR FriendlyName,
    LPCWSTR ImageName,
    PFAX_ROUTING_INSTALLATION_CALLBACKW CallBack,
    void* Context
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", SetLastError = true, ExactSpelling = true)]
static extern bool FaxRegisterRoutingExtensionW(
    IntPtr FaxHandle,   // HANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string ExtensionName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string FriendlyName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string ImageName,   // LPCWSTR
    IntPtr CallBack,   // PFAX_ROUTING_INSTALLATION_CALLBACKW
    IntPtr Context   // void*
);
<DllImport("WINFAX.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FaxRegisterRoutingExtensionW(
    FaxHandle As IntPtr,   ' HANDLE
    <MarshalAs(UnmanagedType.LPWStr)> ExtensionName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> FriendlyName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> ImageName As String,   ' LPCWSTR
    CallBack As IntPtr,   ' PFAX_ROUTING_INSTALLATION_CALLBACKW
    Context As IntPtr   ' void*
) As Boolean
End Function
' FaxHandle : HANDLE
' ExtensionName : LPCWSTR
' FriendlyName : LPCWSTR
' ImageName : LPCWSTR
' CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW
' Context : void*
Declare PtrSafe Function FaxRegisterRoutingExtensionW Lib "winfax" ( _
    ByVal FaxHandle As LongPtr, _
    ByVal ExtensionName As LongPtr, _
    ByVal FriendlyName As LongPtr, _
    ByVal ImageName As LongPtr, _
    ByVal CallBack 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

FaxRegisterRoutingExtensionW = ctypes.windll.winfax.FaxRegisterRoutingExtensionW
FaxRegisterRoutingExtensionW.restype = wintypes.BOOL
FaxRegisterRoutingExtensionW.argtypes = [
    wintypes.HANDLE,  # FaxHandle : HANDLE
    wintypes.LPCWSTR,  # ExtensionName : LPCWSTR
    wintypes.LPCWSTR,  # FriendlyName : LPCWSTR
    wintypes.LPCWSTR,  # ImageName : LPCWSTR
    ctypes.c_void_p,  # CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW
    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')
FaxRegisterRoutingExtensionW = Fiddle::Function.new(
  lib['FaxRegisterRoutingExtensionW'],
  [
    Fiddle::TYPE_VOIDP,  # FaxHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # ExtensionName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # FriendlyName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # ImageName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW
    Fiddle::TYPE_VOIDP,  # Context : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "winfax")]
extern "system" {
    fn FaxRegisterRoutingExtensionW(
        FaxHandle: *mut core::ffi::c_void,  // HANDLE
        ExtensionName: *const u16,  // LPCWSTR
        FriendlyName: *const u16,  // LPCWSTR
        ImageName: *const u16,  // LPCWSTR
        CallBack: *const core::ffi::c_void,  // PFAX_ROUTING_INSTALLATION_CALLBACKW
        Context: *mut ()  // void*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", SetLastError = true)]
public static extern bool FaxRegisterRoutingExtensionW(IntPtr FaxHandle, [MarshalAs(UnmanagedType.LPWStr)] string ExtensionName, [MarshalAs(UnmanagedType.LPWStr)] string FriendlyName, [MarshalAs(UnmanagedType.LPWStr)] string ImageName, IntPtr CallBack, IntPtr Context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINFAX_FaxRegisterRoutingExtensionW' -Namespace Win32 -PassThru
# $api::FaxRegisterRoutingExtensionW(FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context)
#uselib "WINFAX.dll"
#func global FaxRegisterRoutingExtensionW "FaxRegisterRoutingExtensionW" sptr, sptr, sptr, sptr, sptr, sptr
; FaxRegisterRoutingExtensionW FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context   ; 戻り値は stat
; FaxHandle : HANDLE -> "sptr"
; ExtensionName : LPCWSTR -> "sptr"
; FriendlyName : LPCWSTR -> "sptr"
; ImageName : LPCWSTR -> "sptr"
; CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW -> "sptr"
; Context : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WINFAX.dll"
#cfunc global FaxRegisterRoutingExtensionW "FaxRegisterRoutingExtensionW" sptr, wstr, wstr, wstr, sptr, sptr
; res = FaxRegisterRoutingExtensionW(FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context)
; FaxHandle : HANDLE -> "sptr"
; ExtensionName : LPCWSTR -> "wstr"
; FriendlyName : LPCWSTR -> "wstr"
; ImageName : LPCWSTR -> "wstr"
; CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW -> "sptr"
; Context : void* -> "sptr"
; BOOL FaxRegisterRoutingExtensionW(HANDLE FaxHandle, LPCWSTR ExtensionName, LPCWSTR FriendlyName, LPCWSTR ImageName, PFAX_ROUTING_INSTALLATION_CALLBACKW CallBack, void* Context)
#uselib "WINFAX.dll"
#cfunc global FaxRegisterRoutingExtensionW "FaxRegisterRoutingExtensionW" intptr, wstr, wstr, wstr, intptr, intptr
; res = FaxRegisterRoutingExtensionW(FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context)
; FaxHandle : HANDLE -> "intptr"
; ExtensionName : LPCWSTR -> "wstr"
; FriendlyName : LPCWSTR -> "wstr"
; ImageName : LPCWSTR -> "wstr"
; CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW -> "intptr"
; Context : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winfax = windows.NewLazySystemDLL("WINFAX.dll")
	procFaxRegisterRoutingExtensionW = winfax.NewProc("FaxRegisterRoutingExtensionW")
)

// FaxHandle (HANDLE), ExtensionName (LPCWSTR), FriendlyName (LPCWSTR), ImageName (LPCWSTR), CallBack (PFAX_ROUTING_INSTALLATION_CALLBACKW), Context (void*)
r1, _, err := procFaxRegisterRoutingExtensionW.Call(
	uintptr(FaxHandle),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ExtensionName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(FriendlyName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ImageName))),
	uintptr(CallBack),
	uintptr(Context),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FaxRegisterRoutingExtensionW(
  FaxHandle: THandle;   // HANDLE
  ExtensionName: PWideChar;   // LPCWSTR
  FriendlyName: PWideChar;   // LPCWSTR
  ImageName: PWideChar;   // LPCWSTR
  CallBack: Pointer;   // PFAX_ROUTING_INSTALLATION_CALLBACKW
  Context: Pointer   // void*
): BOOL; stdcall;
  external 'WINFAX.dll' name 'FaxRegisterRoutingExtensionW';
result := DllCall("WINFAX\FaxRegisterRoutingExtensionW"
    , "Ptr", FaxHandle   ; HANDLE
    , "WStr", ExtensionName   ; LPCWSTR
    , "WStr", FriendlyName   ; LPCWSTR
    , "WStr", ImageName   ; LPCWSTR
    , "Ptr", CallBack   ; PFAX_ROUTING_INSTALLATION_CALLBACKW
    , "Ptr", Context   ; void*
    , "Int")   ; return: BOOL
●FaxRegisterRoutingExtensionW(FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context) = DLL("WINFAX.dll", "bool FaxRegisterRoutingExtensionW(void*, char*, char*, char*, void*, void*)")
# 呼び出し: FaxRegisterRoutingExtensionW(FaxHandle, ExtensionName, FriendlyName, ImageName, CallBack, Context)
# FaxHandle : HANDLE -> "void*"
# ExtensionName : LPCWSTR -> "char*"
# FriendlyName : LPCWSTR -> "char*"
# ImageName : LPCWSTR -> "char*"
# CallBack : PFAX_ROUTING_INSTALLATION_CALLBACKW -> "void*"
# Context : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。