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

FaxEnumRoutingMethodsW

関数
指定したポートで利用可能なルーティング方法を列挙する。
DLLWINFAX.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

// WINFAX.dll  (Unicode / -W)
#include <windows.h>

BOOL FaxEnumRoutingMethodsW(
    HANDLE FaxPortHandle,
    FAX_ROUTING_METHODW** RoutingMethod,
    DWORD* MethodsReturned
);

パラメーター

名前方向
FaxPortHandleHANDLEin
RoutingMethodFAX_ROUTING_METHODW**out
MethodsReturnedDWORD*out

戻り値の型: BOOL

各言語での呼び出し定義

// WINFAX.dll  (Unicode / -W)
#include <windows.h>

BOOL FaxEnumRoutingMethodsW(
    HANDLE FaxPortHandle,
    FAX_ROUTING_METHODW** RoutingMethod,
    DWORD* MethodsReturned
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool FaxEnumRoutingMethodsW(
    IntPtr FaxPortHandle,   // HANDLE
    IntPtr RoutingMethod,   // FAX_ROUTING_METHODW** out
    out uint MethodsReturned   // DWORD* out
);
<DllImport("WINFAX.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FaxEnumRoutingMethodsW(
    FaxPortHandle As IntPtr,   ' HANDLE
    RoutingMethod As IntPtr,   ' FAX_ROUTING_METHODW** out
    <Out> ByRef MethodsReturned As UInteger   ' DWORD* out
) As Boolean
End Function
' FaxPortHandle : HANDLE
' RoutingMethod : FAX_ROUTING_METHODW** out
' MethodsReturned : DWORD* out
Declare PtrSafe Function FaxEnumRoutingMethodsW Lib "winfax" ( _
    ByVal FaxPortHandle As LongPtr, _
    ByVal RoutingMethod As LongPtr, _
    ByRef MethodsReturned As Long) 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

FaxEnumRoutingMethodsW = ctypes.windll.winfax.FaxEnumRoutingMethodsW
FaxEnumRoutingMethodsW.restype = wintypes.BOOL
FaxEnumRoutingMethodsW.argtypes = [
    wintypes.HANDLE,  # FaxPortHandle : HANDLE
    ctypes.c_void_p,  # RoutingMethod : FAX_ROUTING_METHODW** out
    ctypes.POINTER(wintypes.DWORD),  # MethodsReturned : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WINFAX.dll')
FaxEnumRoutingMethodsW = Fiddle::Function.new(
  lib['FaxEnumRoutingMethodsW'],
  [
    Fiddle::TYPE_VOIDP,  # FaxPortHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # RoutingMethod : FAX_ROUTING_METHODW** out
    Fiddle::TYPE_VOIDP,  # MethodsReturned : DWORD* out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "winfax")]
extern "system" {
    fn FaxEnumRoutingMethodsW(
        FaxPortHandle: *mut core::ffi::c_void,  // HANDLE
        RoutingMethod: *mut *mut FAX_ROUTING_METHODW,  // FAX_ROUTING_METHODW** out
        MethodsReturned: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool FaxEnumRoutingMethodsW(IntPtr FaxPortHandle, IntPtr RoutingMethod, out uint MethodsReturned);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINFAX_FaxEnumRoutingMethodsW' -Namespace Win32 -PassThru
# $api::FaxEnumRoutingMethodsW(FaxPortHandle, RoutingMethod, MethodsReturned)
#uselib "WINFAX.dll"
#func global FaxEnumRoutingMethodsW "FaxEnumRoutingMethodsW" wptr, wptr, wptr
; FaxEnumRoutingMethodsW FaxPortHandle, varptr(RoutingMethod), varptr(MethodsReturned)   ; 戻り値は stat
; FaxPortHandle : HANDLE -> "wptr"
; RoutingMethod : FAX_ROUTING_METHODW** out -> "wptr"
; MethodsReturned : DWORD* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WINFAX.dll"
#cfunc global FaxEnumRoutingMethodsW "FaxEnumRoutingMethodsW" sptr, var, var
; res = FaxEnumRoutingMethodsW(FaxPortHandle, RoutingMethod, MethodsReturned)
; FaxPortHandle : HANDLE -> "sptr"
; RoutingMethod : FAX_ROUTING_METHODW** out -> "var"
; MethodsReturned : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL FaxEnumRoutingMethodsW(HANDLE FaxPortHandle, FAX_ROUTING_METHODW** RoutingMethod, DWORD* MethodsReturned)
#uselib "WINFAX.dll"
#cfunc global FaxEnumRoutingMethodsW "FaxEnumRoutingMethodsW" intptr, var, var
; res = FaxEnumRoutingMethodsW(FaxPortHandle, RoutingMethod, MethodsReturned)
; FaxPortHandle : HANDLE -> "intptr"
; RoutingMethod : FAX_ROUTING_METHODW** out -> "var"
; MethodsReturned : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winfax = windows.NewLazySystemDLL("WINFAX.dll")
	procFaxEnumRoutingMethodsW = winfax.NewProc("FaxEnumRoutingMethodsW")
)

// FaxPortHandle (HANDLE), RoutingMethod (FAX_ROUTING_METHODW** out), MethodsReturned (DWORD* out)
r1, _, err := procFaxEnumRoutingMethodsW.Call(
	uintptr(FaxPortHandle),
	uintptr(RoutingMethod),
	uintptr(MethodsReturned),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FaxEnumRoutingMethodsW(
  FaxPortHandle: THandle;   // HANDLE
  RoutingMethod: Pointer;   // FAX_ROUTING_METHODW** out
  MethodsReturned: Pointer   // DWORD* out
): BOOL; stdcall;
  external 'WINFAX.dll' name 'FaxEnumRoutingMethodsW';
result := DllCall("WINFAX\FaxEnumRoutingMethodsW"
    , "Ptr", FaxPortHandle   ; HANDLE
    , "Ptr", RoutingMethod   ; FAX_ROUTING_METHODW** out
    , "Ptr", MethodsReturned   ; DWORD* out
    , "Int")   ; return: BOOL
●FaxEnumRoutingMethodsW(FaxPortHandle, RoutingMethod, MethodsReturned) = DLL("WINFAX.dll", "bool FaxEnumRoutingMethodsW(void*, void*, void*)")
# 呼び出し: FaxEnumRoutingMethodsW(FaxPortHandle, RoutingMethod, MethodsReturned)
# FaxPortHandle : HANDLE -> "void*"
# RoutingMethod : FAX_ROUTING_METHODW** out -> "void*"
# MethodsReturned : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。