ホーム › Devices.Fax › FaxGetConfigurationA
FaxGetConfigurationA
関数ファクスサーバーの構成設定を取得する。
シグネチャ
// WINFAX.dll (ANSI / -A)
#include <windows.h>
BOOL FaxGetConfigurationA(
HANDLE FaxHandle,
FAX_CONFIGURATIONA** FaxConfig
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| FaxHandle | HANDLE | in | FAXサーバー接続のハンドルを指定する。 |
| FaxConfig | FAX_CONFIGURATIONA** | out | サーバー構成情報(FAX_CONFIGURATIONA)を受け取るポインタ。FaxFreeBufferで解放する。 |
戻り値の型: BOOL
各言語での呼び出し定義
// WINFAX.dll (ANSI / -A)
#include <windows.h>
BOOL FaxGetConfigurationA(
HANDLE FaxHandle,
FAX_CONFIGURATIONA** FaxConfig
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WINFAX.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool FaxGetConfigurationA(
IntPtr FaxHandle, // HANDLE
IntPtr FaxConfig // FAX_CONFIGURATIONA** out
);<DllImport("WINFAX.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FaxGetConfigurationA(
FaxHandle As IntPtr, ' HANDLE
FaxConfig As IntPtr ' FAX_CONFIGURATIONA** out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' FaxHandle : HANDLE
' FaxConfig : FAX_CONFIGURATIONA** out
Declare PtrSafe Function FaxGetConfigurationA Lib "winfax" ( _
ByVal FaxHandle As LongPtr, _
ByVal FaxConfig As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FaxGetConfigurationA = ctypes.windll.winfax.FaxGetConfigurationA
FaxGetConfigurationA.restype = wintypes.BOOL
FaxGetConfigurationA.argtypes = [
wintypes.HANDLE, # FaxHandle : HANDLE
ctypes.c_void_p, # FaxConfig : FAX_CONFIGURATIONA** out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINFAX.dll')
FaxGetConfigurationA = Fiddle::Function.new(
lib['FaxGetConfigurationA'],
[
Fiddle::TYPE_VOIDP, # FaxHandle : HANDLE
Fiddle::TYPE_VOIDP, # FaxConfig : FAX_CONFIGURATIONA** out
],
Fiddle::TYPE_INT)#[link(name = "winfax")]
extern "system" {
fn FaxGetConfigurationA(
FaxHandle: *mut core::ffi::c_void, // HANDLE
FaxConfig: *mut *mut FAX_CONFIGURATIONA // FAX_CONFIGURATIONA** out
) -> 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 FaxGetConfigurationA(IntPtr FaxHandle, IntPtr FaxConfig);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINFAX_FaxGetConfigurationA' -Namespace Win32 -PassThru
# $api::FaxGetConfigurationA(FaxHandle, FaxConfig)#uselib "WINFAX.dll"
#func global FaxGetConfigurationA "FaxGetConfigurationA" sptr, sptr
; FaxGetConfigurationA FaxHandle, varptr(FaxConfig) ; 戻り値は stat
; FaxHandle : HANDLE -> "sptr"
; FaxConfig : FAX_CONFIGURATIONA** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINFAX.dll" #cfunc global FaxGetConfigurationA "FaxGetConfigurationA" sptr, var ; res = FaxGetConfigurationA(FaxHandle, FaxConfig) ; FaxHandle : HANDLE -> "sptr" ; FaxConfig : FAX_CONFIGURATIONA** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINFAX.dll" #cfunc global FaxGetConfigurationA "FaxGetConfigurationA" sptr, sptr ; res = FaxGetConfigurationA(FaxHandle, varptr(FaxConfig)) ; FaxHandle : HANDLE -> "sptr" ; FaxConfig : FAX_CONFIGURATIONA** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL FaxGetConfigurationA(HANDLE FaxHandle, FAX_CONFIGURATIONA** FaxConfig) #uselib "WINFAX.dll" #cfunc global FaxGetConfigurationA "FaxGetConfigurationA" intptr, var ; res = FaxGetConfigurationA(FaxHandle, FaxConfig) ; FaxHandle : HANDLE -> "intptr" ; FaxConfig : FAX_CONFIGURATIONA** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL FaxGetConfigurationA(HANDLE FaxHandle, FAX_CONFIGURATIONA** FaxConfig) #uselib "WINFAX.dll" #cfunc global FaxGetConfigurationA "FaxGetConfigurationA" intptr, intptr ; res = FaxGetConfigurationA(FaxHandle, varptr(FaxConfig)) ; FaxHandle : HANDLE -> "intptr" ; FaxConfig : FAX_CONFIGURATIONA** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winfax = windows.NewLazySystemDLL("WINFAX.dll")
procFaxGetConfigurationA = winfax.NewProc("FaxGetConfigurationA")
)
// FaxHandle (HANDLE), FaxConfig (FAX_CONFIGURATIONA** out)
r1, _, err := procFaxGetConfigurationA.Call(
uintptr(FaxHandle),
uintptr(FaxConfig),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FaxGetConfigurationA(
FaxHandle: THandle; // HANDLE
FaxConfig: Pointer // FAX_CONFIGURATIONA** out
): BOOL; stdcall;
external 'WINFAX.dll' name 'FaxGetConfigurationA';result := DllCall("WINFAX\FaxGetConfigurationA"
, "Ptr", FaxHandle ; HANDLE
, "Ptr", FaxConfig ; FAX_CONFIGURATIONA** out
, "Int") ; return: BOOL●FaxGetConfigurationA(FaxHandle, FaxConfig) = DLL("WINFAX.dll", "bool FaxGetConfigurationA(void*, void*)")
# 呼び出し: FaxGetConfigurationA(FaxHandle, FaxConfig)
# FaxHandle : HANDLE -> "void*"
# FaxConfig : FAX_CONFIGURATIONA** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "winfax" fn FaxGetConfigurationA(
FaxHandle: ?*anyopaque, // HANDLE
FaxConfig: [*c][*c]FAX_CONFIGURATIONA // FAX_CONFIGURATIONA** out
) callconv(std.os.windows.WINAPI) i32;proc FaxGetConfigurationA(
FaxHandle: pointer, # HANDLE
FaxConfig: ptr FAX_CONFIGURATIONA # FAX_CONFIGURATIONA** out
): int32 {.importc: "FaxGetConfigurationA", stdcall, dynlib: "WINFAX.dll".}pragma(lib, "winfax");
extern(Windows)
int FaxGetConfigurationA(
void* FaxHandle, // HANDLE
FAX_CONFIGURATIONA** FaxConfig // FAX_CONFIGURATIONA** out
);ccall((:FaxGetConfigurationA, "WINFAX.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{FAX_CONFIGURATIONA}),
FaxHandle, FaxConfig)
# FaxHandle : HANDLE -> Ptr{Cvoid}
# FaxConfig : FAX_CONFIGURATIONA** out -> Ptr{FAX_CONFIGURATIONA}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t FaxGetConfigurationA(
void* FaxHandle,
void* FaxConfig);
]]
local winfax = ffi.load("winfax")
-- winfax.FaxGetConfigurationA(FaxHandle, FaxConfig)
-- FaxHandle : HANDLE
-- FaxConfig : FAX_CONFIGURATIONA** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WINFAX.dll');
const FaxGetConfigurationA = lib.func('__stdcall', 'FaxGetConfigurationA', 'int32_t', ['void *', 'void *']);
// FaxGetConfigurationA(FaxHandle, FaxConfig)
// FaxHandle : HANDLE -> 'void *'
// FaxConfig : FAX_CONFIGURATIONA** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WINFAX.dll", {
FaxGetConfigurationA: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.FaxGetConfigurationA(FaxHandle, FaxConfig)
// FaxHandle : HANDLE -> "pointer"
// FaxConfig : FAX_CONFIGURATIONA** out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t FaxGetConfigurationA(
void* FaxHandle,
void* FaxConfig);
C, "WINFAX.dll");
// $ffi->FaxGetConfigurationA(FaxHandle, FaxConfig);
// FaxHandle : HANDLE
// FaxConfig : FAX_CONFIGURATIONA** out
// 構造体/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 FaxGetConfigurationA(
Pointer FaxHandle, // HANDLE
Pointer FaxConfig // FAX_CONFIGURATIONA** out
);
}@[Link("winfax")]
lib LibWINFAX
fun FaxGetConfigurationA = FaxGetConfigurationA(
FaxHandle : Void*, # HANDLE
FaxConfig : FAX_CONFIGURATIONA** # FAX_CONFIGURATIONA** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FaxGetConfigurationANative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef FaxGetConfigurationADart = int Function(Pointer<Void>, Pointer<Void>);
final FaxGetConfigurationA = DynamicLibrary.open('WINFAX.dll')
.lookupFunction<FaxGetConfigurationANative, FaxGetConfigurationADart>('FaxGetConfigurationA');
// FaxHandle : HANDLE -> Pointer<Void>
// FaxConfig : FAX_CONFIGURATIONA** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FaxGetConfigurationA(
FaxHandle: THandle; // HANDLE
FaxConfig: Pointer // FAX_CONFIGURATIONA** out
): BOOL; stdcall;
external 'WINFAX.dll' name 'FaxGetConfigurationA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "FaxGetConfigurationA"
c_FaxGetConfigurationA :: Ptr () -> Ptr () -> IO CInt
-- FaxHandle : HANDLE -> Ptr ()
-- FaxConfig : FAX_CONFIGURATIONA** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let faxgetconfigurationa =
foreign "FaxGetConfigurationA"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* FaxHandle : HANDLE -> (ptr void) *)
(* FaxConfig : FAX_CONFIGURATIONA** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library winfax (t "WINFAX.dll"))
(cffi:use-foreign-library winfax)
(cffi:defcfun ("FaxGetConfigurationA" fax-get-configuration-a :convention :stdcall) :int32
(fax-handle :pointer) ; HANDLE
(fax-config :pointer)) ; FAX_CONFIGURATIONA** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FaxGetConfigurationA = Win32::API::More->new('WINFAX',
'BOOL FaxGetConfigurationA(HANDLE FaxHandle, LPVOID FaxConfig)');
# my $ret = $FaxGetConfigurationA->Call($FaxHandle, $FaxConfig);
# FaxHandle : HANDLE -> HANDLE
# FaxConfig : FAX_CONFIGURATIONA** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f FaxGetConfigurationW (Unicode版) — ファクスサーバーの構成設定を取得する。
使用する型