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

lineGetCountryW

関数
指定した国のダイヤル規則や国番号情報を取得する(Unicode版)。
DLLTAPI32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT lineGetCountryW(
    DWORD dwCountryID,
    DWORD dwAPIVersion,
    LINECOUNTRYLIST* lpLineCountryList
);

パラメーター

名前方向
dwCountryIDDWORDin
dwAPIVersionDWORDin
lpLineCountryListLINECOUNTRYLIST*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT lineGetCountryW(
    DWORD dwCountryID,
    DWORD dwAPIVersion,
    LINECOUNTRYLIST* lpLineCountryList
);
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineGetCountryW(
    uint dwCountryID,   // DWORD
    uint dwAPIVersion,   // DWORD
    IntPtr lpLineCountryList   // LINECOUNTRYLIST* in/out
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineGetCountryW(
    dwCountryID As UInteger,   ' DWORD
    dwAPIVersion As UInteger,   ' DWORD
    lpLineCountryList As IntPtr   ' LINECOUNTRYLIST* in/out
) As Integer
End Function
' dwCountryID : DWORD
' dwAPIVersion : DWORD
' lpLineCountryList : LINECOUNTRYLIST* in/out
Declare PtrSafe Function lineGetCountryW Lib "tapi32" ( _
    ByVal dwCountryID As Long, _
    ByVal dwAPIVersion As Long, _
    ByVal lpLineCountryList As LongPtr) 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

lineGetCountryW = ctypes.windll.tapi32.lineGetCountryW
lineGetCountryW.restype = ctypes.c_int
lineGetCountryW.argtypes = [
    wintypes.DWORD,  # dwCountryID : DWORD
    wintypes.DWORD,  # dwAPIVersion : DWORD
    ctypes.c_void_p,  # lpLineCountryList : LINECOUNTRYLIST* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
lineGetCountryW = Fiddle::Function.new(
  lib['lineGetCountryW'],
  [
    -Fiddle::TYPE_INT,  # dwCountryID : DWORD
    -Fiddle::TYPE_INT,  # dwAPIVersion : DWORD
    Fiddle::TYPE_VOIDP,  # lpLineCountryList : LINECOUNTRYLIST* in/out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "tapi32")]
extern "system" {
    fn lineGetCountryW(
        dwCountryID: u32,  // DWORD
        dwAPIVersion: u32,  // DWORD
        lpLineCountryList: *mut LINECOUNTRYLIST  // LINECOUNTRYLIST* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode)]
public static extern int lineGetCountryW(uint dwCountryID, uint dwAPIVersion, IntPtr lpLineCountryList);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetCountryW' -Namespace Win32 -PassThru
# $api::lineGetCountryW(dwCountryID, dwAPIVersion, lpLineCountryList)
#uselib "TAPI32.dll"
#func global lineGetCountryW "lineGetCountryW" wptr, wptr, wptr
; lineGetCountryW dwCountryID, dwAPIVersion, varptr(lpLineCountryList)   ; 戻り値は stat
; dwCountryID : DWORD -> "wptr"
; dwAPIVersion : DWORD -> "wptr"
; lpLineCountryList : LINECOUNTRYLIST* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "TAPI32.dll"
#cfunc global lineGetCountryW "lineGetCountryW" int, int, var
; res = lineGetCountryW(dwCountryID, dwAPIVersion, lpLineCountryList)
; dwCountryID : DWORD -> "int"
; dwAPIVersion : DWORD -> "int"
; lpLineCountryList : LINECOUNTRYLIST* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT lineGetCountryW(DWORD dwCountryID, DWORD dwAPIVersion, LINECOUNTRYLIST* lpLineCountryList)
#uselib "TAPI32.dll"
#cfunc global lineGetCountryW "lineGetCountryW" int, int, var
; res = lineGetCountryW(dwCountryID, dwAPIVersion, lpLineCountryList)
; dwCountryID : DWORD -> "int"
; dwAPIVersion : DWORD -> "int"
; lpLineCountryList : LINECOUNTRYLIST* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineGetCountryW = tapi32.NewProc("lineGetCountryW")
)

// dwCountryID (DWORD), dwAPIVersion (DWORD), lpLineCountryList (LINECOUNTRYLIST* in/out)
r1, _, err := proclineGetCountryW.Call(
	uintptr(dwCountryID),
	uintptr(dwAPIVersion),
	uintptr(lpLineCountryList),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function lineGetCountryW(
  dwCountryID: DWORD;   // DWORD
  dwAPIVersion: DWORD;   // DWORD
  lpLineCountryList: Pointer   // LINECOUNTRYLIST* in/out
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineGetCountryW';
result := DllCall("TAPI32\lineGetCountryW"
    , "UInt", dwCountryID   ; DWORD
    , "UInt", dwAPIVersion   ; DWORD
    , "Ptr", lpLineCountryList   ; LINECOUNTRYLIST* in/out
    , "Int")   ; return: INT
●lineGetCountryW(dwCountryID, dwAPIVersion, lpLineCountryList) = DLL("TAPI32.dll", "int lineGetCountryW(dword, dword, void*)")
# 呼び出し: lineGetCountryW(dwCountryID, dwAPIVersion, lpLineCountryList)
# dwCountryID : DWORD -> "dword"
# dwAPIVersion : DWORD -> "dword"
# lpLineCountryList : LINECOUNTRYLIST* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。