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

lineGetAddressIDA

関数
アドレス文字列から対応するアドレスIDを取得する(ANSI版)。
DLLTAPI32.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// TAPI32.dll  (ANSI / -A)
#include <windows.h>

INT lineGetAddressIDA(
    DWORD hLine,
    DWORD* lpdwAddressID,
    DWORD dwAddressMode,
    LPCSTR lpsAddress,
    DWORD dwSize
);

パラメーター

名前方向
hLineDWORDin
lpdwAddressIDDWORD*inout
dwAddressModeDWORDin
lpsAddressLPCSTRin
dwSizeDWORDin

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll  (ANSI / -A)
#include <windows.h>

INT lineGetAddressIDA(
    DWORD hLine,
    DWORD* lpdwAddressID,
    DWORD dwAddressMode,
    LPCSTR lpsAddress,
    DWORD dwSize
);
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int lineGetAddressIDA(
    uint hLine,   // DWORD
    ref uint lpdwAddressID,   // DWORD* in/out
    uint dwAddressMode,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string lpsAddress,   // LPCSTR
    uint dwSize   // DWORD
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function lineGetAddressIDA(
    hLine As UInteger,   ' DWORD
    ByRef lpdwAddressID As UInteger,   ' DWORD* in/out
    dwAddressMode As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> lpsAddress As String,   ' LPCSTR
    dwSize As UInteger   ' DWORD
) As Integer
End Function
' hLine : DWORD
' lpdwAddressID : DWORD* in/out
' dwAddressMode : DWORD
' lpsAddress : LPCSTR
' dwSize : DWORD
Declare PtrSafe Function lineGetAddressIDA Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByRef lpdwAddressID As Long, _
    ByVal dwAddressMode As Long, _
    ByVal lpsAddress As String, _
    ByVal dwSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

lineGetAddressIDA = ctypes.windll.tapi32.lineGetAddressIDA
lineGetAddressIDA.restype = ctypes.c_int
lineGetAddressIDA.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    ctypes.POINTER(wintypes.DWORD),  # lpdwAddressID : DWORD* in/out
    wintypes.DWORD,  # dwAddressMode : DWORD
    wintypes.LPCSTR,  # lpsAddress : LPCSTR
    wintypes.DWORD,  # dwSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
lineGetAddressIDA = Fiddle::Function.new(
  lib['lineGetAddressIDA'],
  [
    -Fiddle::TYPE_INT,  # hLine : DWORD
    Fiddle::TYPE_VOIDP,  # lpdwAddressID : DWORD* in/out
    -Fiddle::TYPE_INT,  # dwAddressMode : DWORD
    Fiddle::TYPE_VOIDP,  # lpsAddress : LPCSTR
    -Fiddle::TYPE_INT,  # dwSize : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "tapi32")]
extern "system" {
    fn lineGetAddressIDA(
        hLine: u32,  // DWORD
        lpdwAddressID: *mut u32,  // DWORD* in/out
        dwAddressMode: u32,  // DWORD
        lpsAddress: *const u8,  // LPCSTR
        dwSize: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi)]
public static extern int lineGetAddressIDA(uint hLine, ref uint lpdwAddressID, uint dwAddressMode, [MarshalAs(UnmanagedType.LPStr)] string lpsAddress, uint dwSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetAddressIDA' -Namespace Win32 -PassThru
# $api::lineGetAddressIDA(hLine, lpdwAddressID, dwAddressMode, lpsAddress, dwSize)
#uselib "TAPI32.dll"
#func global lineGetAddressIDA "lineGetAddressIDA" sptr, sptr, sptr, sptr, sptr
; lineGetAddressIDA hLine, varptr(lpdwAddressID), dwAddressMode, lpsAddress, dwSize   ; 戻り値は stat
; hLine : DWORD -> "sptr"
; lpdwAddressID : DWORD* in/out -> "sptr"
; dwAddressMode : DWORD -> "sptr"
; lpsAddress : LPCSTR -> "sptr"
; dwSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "TAPI32.dll"
#cfunc global lineGetAddressIDA "lineGetAddressIDA" int, var, int, str, int
; res = lineGetAddressIDA(hLine, lpdwAddressID, dwAddressMode, lpsAddress, dwSize)
; hLine : DWORD -> "int"
; lpdwAddressID : DWORD* in/out -> "var"
; dwAddressMode : DWORD -> "int"
; lpsAddress : LPCSTR -> "str"
; dwSize : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT lineGetAddressIDA(DWORD hLine, DWORD* lpdwAddressID, DWORD dwAddressMode, LPCSTR lpsAddress, DWORD dwSize)
#uselib "TAPI32.dll"
#cfunc global lineGetAddressIDA "lineGetAddressIDA" int, var, int, str, int
; res = lineGetAddressIDA(hLine, lpdwAddressID, dwAddressMode, lpsAddress, dwSize)
; hLine : DWORD -> "int"
; lpdwAddressID : DWORD* in/out -> "var"
; dwAddressMode : DWORD -> "int"
; lpsAddress : LPCSTR -> "str"
; dwSize : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineGetAddressIDA = tapi32.NewProc("lineGetAddressIDA")
)

// hLine (DWORD), lpdwAddressID (DWORD* in/out), dwAddressMode (DWORD), lpsAddress (LPCSTR), dwSize (DWORD)
r1, _, err := proclineGetAddressIDA.Call(
	uintptr(hLine),
	uintptr(lpdwAddressID),
	uintptr(dwAddressMode),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpsAddress))),
	uintptr(dwSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function lineGetAddressIDA(
  hLine: DWORD;   // DWORD
  lpdwAddressID: Pointer;   // DWORD* in/out
  dwAddressMode: DWORD;   // DWORD
  lpsAddress: PAnsiChar;   // LPCSTR
  dwSize: DWORD   // DWORD
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineGetAddressIDA';
result := DllCall("TAPI32\lineGetAddressIDA"
    , "UInt", hLine   ; DWORD
    , "Ptr", lpdwAddressID   ; DWORD* in/out
    , "UInt", dwAddressMode   ; DWORD
    , "AStr", lpsAddress   ; LPCSTR
    , "UInt", dwSize   ; DWORD
    , "Int")   ; return: INT
●lineGetAddressIDA(hLine, lpdwAddressID, dwAddressMode, lpsAddress, dwSize) = DLL("TAPI32.dll", "int lineGetAddressIDA(dword, void*, dword, char*, dword)")
# 呼び出し: lineGetAddressIDA(hLine, lpdwAddressID, dwAddressMode, lpsAddress, dwSize)
# hLine : DWORD -> "dword"
# lpdwAddressID : DWORD* in/out -> "void*"
# dwAddressMode : DWORD -> "dword"
# lpsAddress : LPCSTR -> "char*"
# dwSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。