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

LINECOUNTRYENTRY

構造体
サイズx64: 44 バイト / x86: 44 バイトパッキング1

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwCountryIDDWORD4+0+0国/地域を識別するIDを表す。
dwCountryCodeDWORD4+4+4国際電話の国番号を表す。
dwNextCountryIDDWORD4+8+8リスト内で次に続く国エントリのIDを表す。
dwCountryNameSizeDWORD4+12+12国名文字列のサイズをバイトで表す。
dwCountryNameOffsetDWORD4+16+16国名文字列までのオフセットをバイトで表す。
dwSameAreaRuleSizeDWORD4+20+20同一市内通話の発信規則文字列のサイズをバイトで表す。
dwSameAreaRuleOffsetDWORD4+24+24同一市内通話規則文字列までのオフセット。
dwLongDistanceRuleSizeDWORD4+28+28長距離通話の発信規則文字列のサイズをバイトで表す。
dwLongDistanceRuleOffsetDWORD4+32+32長距離通話規則文字列までのオフセット。
dwInternationalRuleSizeDWORD4+36+36国際通話の発信規則文字列のサイズをバイトで表す。
dwInternationalRuleOffsetDWORD4+40+40国際通話規則文字列までのオフセット。

各言語での定義

#include <windows.h>

// LINECOUNTRYENTRY  (x64 44 / x86 44 バイト)
#pragma pack(push, 1)
typedef struct LINECOUNTRYENTRY {
    DWORD dwCountryID;
    DWORD dwCountryCode;
    DWORD dwNextCountryID;
    DWORD dwCountryNameSize;
    DWORD dwCountryNameOffset;
    DWORD dwSameAreaRuleSize;
    DWORD dwSameAreaRuleOffset;
    DWORD dwLongDistanceRuleSize;
    DWORD dwLongDistanceRuleOffset;
    DWORD dwInternationalRuleSize;
    DWORD dwInternationalRuleOffset;
} LINECOUNTRYENTRY;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct LINECOUNTRYENTRY
{
    public uint dwCountryID;
    public uint dwCountryCode;
    public uint dwNextCountryID;
    public uint dwCountryNameSize;
    public uint dwCountryNameOffset;
    public uint dwSameAreaRuleSize;
    public uint dwSameAreaRuleOffset;
    public uint dwLongDistanceRuleSize;
    public uint dwLongDistanceRuleOffset;
    public uint dwInternationalRuleSize;
    public uint dwInternationalRuleOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure LINECOUNTRYENTRY
    Public dwCountryID As UInteger
    Public dwCountryCode As UInteger
    Public dwNextCountryID As UInteger
    Public dwCountryNameSize As UInteger
    Public dwCountryNameOffset As UInteger
    Public dwSameAreaRuleSize As UInteger
    Public dwSameAreaRuleOffset As UInteger
    Public dwLongDistanceRuleSize As UInteger
    Public dwLongDistanceRuleOffset As UInteger
    Public dwInternationalRuleSize As UInteger
    Public dwInternationalRuleOffset As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LINECOUNTRYENTRY(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwCountryID", wintypes.DWORD),
        ("dwCountryCode", wintypes.DWORD),
        ("dwNextCountryID", wintypes.DWORD),
        ("dwCountryNameSize", wintypes.DWORD),
        ("dwCountryNameOffset", wintypes.DWORD),
        ("dwSameAreaRuleSize", wintypes.DWORD),
        ("dwSameAreaRuleOffset", wintypes.DWORD),
        ("dwLongDistanceRuleSize", wintypes.DWORD),
        ("dwLongDistanceRuleOffset", wintypes.DWORD),
        ("dwInternationalRuleSize", wintypes.DWORD),
        ("dwInternationalRuleOffset", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct LINECOUNTRYENTRY {
    pub dwCountryID: u32,
    pub dwCountryCode: u32,
    pub dwNextCountryID: u32,
    pub dwCountryNameSize: u32,
    pub dwCountryNameOffset: u32,
    pub dwSameAreaRuleSize: u32,
    pub dwSameAreaRuleOffset: u32,
    pub dwLongDistanceRuleSize: u32,
    pub dwLongDistanceRuleOffset: u32,
    pub dwInternationalRuleSize: u32,
    pub dwInternationalRuleOffset: u32,
}
import "golang.org/x/sys/windows"

type LINECOUNTRYENTRY struct {
	dwCountryID uint32
	dwCountryCode uint32
	dwNextCountryID uint32
	dwCountryNameSize uint32
	dwCountryNameOffset uint32
	dwSameAreaRuleSize uint32
	dwSameAreaRuleOffset uint32
	dwLongDistanceRuleSize uint32
	dwLongDistanceRuleOffset uint32
	dwInternationalRuleSize uint32
	dwInternationalRuleOffset uint32
}
type
  LINECOUNTRYENTRY = packed record
    dwCountryID: DWORD;
    dwCountryCode: DWORD;
    dwNextCountryID: DWORD;
    dwCountryNameSize: DWORD;
    dwCountryNameOffset: DWORD;
    dwSameAreaRuleSize: DWORD;
    dwSameAreaRuleOffset: DWORD;
    dwLongDistanceRuleSize: DWORD;
    dwLongDistanceRuleOffset: DWORD;
    dwInternationalRuleSize: DWORD;
    dwInternationalRuleOffset: DWORD;
  end;
const LINECOUNTRYENTRY = extern struct {
    dwCountryID: u32,
    dwCountryCode: u32,
    dwNextCountryID: u32,
    dwCountryNameSize: u32,
    dwCountryNameOffset: u32,
    dwSameAreaRuleSize: u32,
    dwSameAreaRuleOffset: u32,
    dwLongDistanceRuleSize: u32,
    dwLongDistanceRuleOffset: u32,
    dwInternationalRuleSize: u32,
    dwInternationalRuleOffset: u32,
};
type
  LINECOUNTRYENTRY {.packed.} = object
    dwCountryID: uint32
    dwCountryCode: uint32
    dwNextCountryID: uint32
    dwCountryNameSize: uint32
    dwCountryNameOffset: uint32
    dwSameAreaRuleSize: uint32
    dwSameAreaRuleOffset: uint32
    dwLongDistanceRuleSize: uint32
    dwLongDistanceRuleOffset: uint32
    dwInternationalRuleSize: uint32
    dwInternationalRuleOffset: uint32
align(1)
struct LINECOUNTRYENTRY
{
    uint dwCountryID;
    uint dwCountryCode;
    uint dwNextCountryID;
    uint dwCountryNameSize;
    uint dwCountryNameOffset;
    uint dwSameAreaRuleSize;
    uint dwSameAreaRuleOffset;
    uint dwLongDistanceRuleSize;
    uint dwLongDistanceRuleOffset;
    uint dwInternationalRuleSize;
    uint dwInternationalRuleOffset;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LINECOUNTRYENTRY サイズ: 44 バイト(x64)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; dwCountryID : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwCountryCode : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwNextCountryID : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwCountryNameSize : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwCountryNameOffset : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwSameAreaRuleSize : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwSameAreaRuleOffset : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwLongDistanceRuleSize : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwLongDistanceRuleOffset : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwInternationalRuleSize : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwInternationalRuleOffset : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LINECOUNTRYENTRY, pack=1
    #field int dwCountryID
    #field int dwCountryCode
    #field int dwNextCountryID
    #field int dwCountryNameSize
    #field int dwCountryNameOffset
    #field int dwSameAreaRuleSize
    #field int dwSameAreaRuleOffset
    #field int dwLongDistanceRuleSize
    #field int dwLongDistanceRuleOffset
    #field int dwInternationalRuleSize
    #field int dwInternationalRuleOffset
#endstruct

stdim st, LINECOUNTRYENTRY        ; NSTRUCT 変数を確保
st->dwCountryID = 100
mes "dwCountryID=" + st->dwCountryID