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

lineSetAgentState

関数
アドレス上のエージェントの状態と次状態を設定する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

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

INT lineSetAgentState(
    DWORD hLine,
    DWORD dwAddressID,
    DWORD dwAgentState,
    DWORD dwNextAgentState
);

パラメーター

名前方向
hLineDWORDin
dwAddressIDDWORDin
dwAgentStateDWORDin
dwNextAgentStateDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

INT lineSetAgentState(
    DWORD hLine,
    DWORD dwAddressID,
    DWORD dwAgentState,
    DWORD dwNextAgentState
);
[DllImport("TAPI32.dll", ExactSpelling = true)]
static extern int lineSetAgentState(
    uint hLine,   // DWORD
    uint dwAddressID,   // DWORD
    uint dwAgentState,   // DWORD
    uint dwNextAgentState   // DWORD
);
<DllImport("TAPI32.dll", ExactSpelling:=True)>
Public Shared Function lineSetAgentState(
    hLine As UInteger,   ' DWORD
    dwAddressID As UInteger,   ' DWORD
    dwAgentState As UInteger,   ' DWORD
    dwNextAgentState As UInteger   ' DWORD
) As Integer
End Function
' hLine : DWORD
' dwAddressID : DWORD
' dwAgentState : DWORD
' dwNextAgentState : DWORD
Declare PtrSafe Function lineSetAgentState Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByVal dwAddressID As Long, _
    ByVal dwAgentState As Long, _
    ByVal dwNextAgentState As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

lineSetAgentState = ctypes.windll.tapi32.lineSetAgentState
lineSetAgentState.restype = ctypes.c_int
lineSetAgentState.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    wintypes.DWORD,  # dwAddressID : DWORD
    wintypes.DWORD,  # dwAgentState : DWORD
    wintypes.DWORD,  # dwNextAgentState : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
lineSetAgentState = Fiddle::Function.new(
  lib['lineSetAgentState'],
  [
    -Fiddle::TYPE_INT,  # hLine : DWORD
    -Fiddle::TYPE_INT,  # dwAddressID : DWORD
    -Fiddle::TYPE_INT,  # dwAgentState : DWORD
    -Fiddle::TYPE_INT,  # dwNextAgentState : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "tapi32")]
extern "system" {
    fn lineSetAgentState(
        hLine: u32,  // DWORD
        dwAddressID: u32,  // DWORD
        dwAgentState: u32,  // DWORD
        dwNextAgentState: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll")]
public static extern int lineSetAgentState(uint hLine, uint dwAddressID, uint dwAgentState, uint dwNextAgentState);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineSetAgentState' -Namespace Win32 -PassThru
# $api::lineSetAgentState(hLine, dwAddressID, dwAgentState, dwNextAgentState)
#uselib "TAPI32.dll"
#func global lineSetAgentState "lineSetAgentState" sptr, sptr, sptr, sptr
; lineSetAgentState hLine, dwAddressID, dwAgentState, dwNextAgentState   ; 戻り値は stat
; hLine : DWORD -> "sptr"
; dwAddressID : DWORD -> "sptr"
; dwAgentState : DWORD -> "sptr"
; dwNextAgentState : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "TAPI32.dll"
#cfunc global lineSetAgentState "lineSetAgentState" int, int, int, int
; res = lineSetAgentState(hLine, dwAddressID, dwAgentState, dwNextAgentState)
; hLine : DWORD -> "int"
; dwAddressID : DWORD -> "int"
; dwAgentState : DWORD -> "int"
; dwNextAgentState : DWORD -> "int"
; INT lineSetAgentState(DWORD hLine, DWORD dwAddressID, DWORD dwAgentState, DWORD dwNextAgentState)
#uselib "TAPI32.dll"
#cfunc global lineSetAgentState "lineSetAgentState" int, int, int, int
; res = lineSetAgentState(hLine, dwAddressID, dwAgentState, dwNextAgentState)
; hLine : DWORD -> "int"
; dwAddressID : DWORD -> "int"
; dwAgentState : DWORD -> "int"
; dwNextAgentState : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineSetAgentState = tapi32.NewProc("lineSetAgentState")
)

// hLine (DWORD), dwAddressID (DWORD), dwAgentState (DWORD), dwNextAgentState (DWORD)
r1, _, err := proclineSetAgentState.Call(
	uintptr(hLine),
	uintptr(dwAddressID),
	uintptr(dwAgentState),
	uintptr(dwNextAgentState),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function lineSetAgentState(
  hLine: DWORD;   // DWORD
  dwAddressID: DWORD;   // DWORD
  dwAgentState: DWORD;   // DWORD
  dwNextAgentState: DWORD   // DWORD
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineSetAgentState';
result := DllCall("TAPI32\lineSetAgentState"
    , "UInt", hLine   ; DWORD
    , "UInt", dwAddressID   ; DWORD
    , "UInt", dwAgentState   ; DWORD
    , "UInt", dwNextAgentState   ; DWORD
    , "Int")   ; return: INT
●lineSetAgentState(hLine, dwAddressID, dwAgentState, dwNextAgentState) = DLL("TAPI32.dll", "int lineSetAgentState(dword, dword, dword, dword)")
# 呼び出し: lineSetAgentState(hLine, dwAddressID, dwAgentState, dwNextAgentState)
# hLine : DWORD -> "dword"
# dwAddressID : DWORD -> "dword"
# dwAgentState : DWORD -> "dword"
# dwNextAgentState : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。