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

MODEMSETTINGS

構造体
サイズx64: 48 バイト / x86: 48 バイト

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

フィールド

フィールドサイズx64x86説明
dwActualSizeDWORD4+0+0アプリケーションに実際に返されたデータのサイズ (バイト単位)。アプリケーションが構造体の可変長部分に十分な領域を確保しなかった場合、このメンバーは dwRequiredSize メンバーよりも小さくなることがあります。
dwRequiredSizeDWORD4+4+4可変長部分を含む MODEMDEVCAPS 構造体全体に必要なバイト数です。
dwDevSpecificOffsetDWORD4+8+8構造体のうちプロバイダー定義部分のオフセットです。構造体の先頭からのバイト単位の相対位置で表されます。
dwDevSpecificSizeDWORD4+12+12構造体のうちプロバイダー定義部分のサイズ (バイト単位)。
dwCallSetupFailTimerDWORD4+16+16ダイヤルの完了後、モデム間の接続が確立されたことを示す通知をモデムが待機する最大秒数です。この時間内に接続が確立されない場合、呼び出しは失敗したものと見なされます。このメンバーは Hayes® 互換モデムのレジスター S7 に相当します。
dwInactivityTimeoutDWORD4+20+20接続の確立後に許容される、無通信状態の最大秒数です。この時間の間にデータの送信も受信も行われない場合、呼び出しは自動的に終了します。このタイムアウトは、アプリケーションが予期せず停止した場合やユーザーが離席した場合に、長距離通話料金やオンラインサービス料金が過大になるのを避けるために使用されます。
dwSpeakerVolumeMODEM_SPEAKER_VOLUME4+24+24

モニタースピーカーがオンのときの音量レベルです。このメンバーには次の値のいずれかを指定できます。

意味
MDMVOL_HIGH
0x00000002
大音量です。
MDMVOL_LOW
0x00000000
小音量です。
MDMVOL_MEDIUM
0x00000001
中程度の音量です。

モデムがサポートするスピーカー音量は MODEMDEVCAPS 構造体で指定されます。実際の音量はハードウェアに依存します。

dwSpeakerModeMODEMSETTINGS_SPEAKER_MODE4+28+28

スピーカーのモードです。このメンバーには次の値のいずれかを指定できます。

意味
MDMSPKR_CALLSETUP
0x00000008
接続が確立されるまでスピーカーがオンになります。
MDMSPKR_DIAL
0x00000002
接続が確立されるまでスピーカーがオンになります。ただし、モデムが実際にダイヤルしている間はオフになります。
MDMSPKR_OFF
0x00000001
スピーカーは常にオフです。
MDMSPKR_ON
0x00000004
スピーカーは常にオンです。
dwPreferredModemOptionsDWORD4+32+32

アプリケーションが要求するモデムオプションです。モデムオプションは呼び出しのセットアップ時にローカルモデムとリモートモデムの間でネゴシエートされます。このメンバーは、ローカルモデムの初期のネゴシエーション条件を指定します。

ローカルモデムがサポートするモデムオプションは、 MODEMDEVCAPS 構造体の dwModemOptions メンバーで指定されます。モデムオプションの一覧については、 MODEMDEVCAPS 構造体の説明を参照してください。

dwNegotiatedModemOptionsDWORD4+36+36

実際に有効になっているモデムオプションです。このメンバーは、接続が確立され、ローカルモデムとリモートモデムがモデムオプションをネゴシエートした後に設定されます。

ローカルモデムがサポートするモデムオプションは、 MODEMDEVCAPS 構造体の dwModemOptions メンバーで指定されます。モデムオプションの一覧については、 MODEMDEVCAPS 構造体の説明を参照してください。

dwNegotiatedDCERateDWORD4+40+40有効になっている DCE レートです。このメンバーは、接続が確立され、ローカルモデムとリモートモデムが変調方式をネゴシエートした後に設定されます。
abVariablePortionBYTE1+44+44省略可能な、プロバイダー定義の情報です。

公式ドキュメント

モデムの構成に関する情報を格納します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// MODEMSETTINGS  (x64 48 / x86 48 バイト)
typedef struct MODEMSETTINGS {
    DWORD dwActualSize;
    DWORD dwRequiredSize;
    DWORD dwDevSpecificOffset;
    DWORD dwDevSpecificSize;
    DWORD dwCallSetupFailTimer;
    DWORD dwInactivityTimeout;
    MODEM_SPEAKER_VOLUME dwSpeakerVolume;
    MODEMSETTINGS_SPEAKER_MODE dwSpeakerMode;
    DWORD dwPreferredModemOptions;
    DWORD dwNegotiatedModemOptions;
    DWORD dwNegotiatedDCERate;
    BYTE abVariablePortion[1];
} MODEMSETTINGS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MODEMSETTINGS
{
    public uint dwActualSize;
    public uint dwRequiredSize;
    public uint dwDevSpecificOffset;
    public uint dwDevSpecificSize;
    public uint dwCallSetupFailTimer;
    public uint dwInactivityTimeout;
    public uint dwSpeakerVolume;
    public uint dwSpeakerMode;
    public uint dwPreferredModemOptions;
    public uint dwNegotiatedModemOptions;
    public uint dwNegotiatedDCERate;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] abVariablePortion;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MODEMSETTINGS
    Public dwActualSize As UInteger
    Public dwRequiredSize As UInteger
    Public dwDevSpecificOffset As UInteger
    Public dwDevSpecificSize As UInteger
    Public dwCallSetupFailTimer As UInteger
    Public dwInactivityTimeout As UInteger
    Public dwSpeakerVolume As UInteger
    Public dwSpeakerMode As UInteger
    Public dwPreferredModemOptions As UInteger
    Public dwNegotiatedModemOptions As UInteger
    Public dwNegotiatedDCERate As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public abVariablePortion() As Byte
End Structure
import ctypes
from ctypes import wintypes

class MODEMSETTINGS(ctypes.Structure):
    _fields_ = [
        ("dwActualSize", wintypes.DWORD),
        ("dwRequiredSize", wintypes.DWORD),
        ("dwDevSpecificOffset", wintypes.DWORD),
        ("dwDevSpecificSize", wintypes.DWORD),
        ("dwCallSetupFailTimer", wintypes.DWORD),
        ("dwInactivityTimeout", wintypes.DWORD),
        ("dwSpeakerVolume", wintypes.DWORD),
        ("dwSpeakerMode", wintypes.DWORD),
        ("dwPreferredModemOptions", wintypes.DWORD),
        ("dwNegotiatedModemOptions", wintypes.DWORD),
        ("dwNegotiatedDCERate", wintypes.DWORD),
        ("abVariablePortion", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct MODEMSETTINGS {
    pub dwActualSize: u32,
    pub dwRequiredSize: u32,
    pub dwDevSpecificOffset: u32,
    pub dwDevSpecificSize: u32,
    pub dwCallSetupFailTimer: u32,
    pub dwInactivityTimeout: u32,
    pub dwSpeakerVolume: u32,
    pub dwSpeakerMode: u32,
    pub dwPreferredModemOptions: u32,
    pub dwNegotiatedModemOptions: u32,
    pub dwNegotiatedDCERate: u32,
    pub abVariablePortion: [u8; 1],
}
import "golang.org/x/sys/windows"

type MODEMSETTINGS struct {
	dwActualSize uint32
	dwRequiredSize uint32
	dwDevSpecificOffset uint32
	dwDevSpecificSize uint32
	dwCallSetupFailTimer uint32
	dwInactivityTimeout uint32
	dwSpeakerVolume uint32
	dwSpeakerMode uint32
	dwPreferredModemOptions uint32
	dwNegotiatedModemOptions uint32
	dwNegotiatedDCERate uint32
	abVariablePortion [1]byte
}
type
  MODEMSETTINGS = record
    dwActualSize: DWORD;
    dwRequiredSize: DWORD;
    dwDevSpecificOffset: DWORD;
    dwDevSpecificSize: DWORD;
    dwCallSetupFailTimer: DWORD;
    dwInactivityTimeout: DWORD;
    dwSpeakerVolume: DWORD;
    dwSpeakerMode: DWORD;
    dwPreferredModemOptions: DWORD;
    dwNegotiatedModemOptions: DWORD;
    dwNegotiatedDCERate: DWORD;
    abVariablePortion: array[0..0] of Byte;
  end;
const MODEMSETTINGS = extern struct {
    dwActualSize: u32,
    dwRequiredSize: u32,
    dwDevSpecificOffset: u32,
    dwDevSpecificSize: u32,
    dwCallSetupFailTimer: u32,
    dwInactivityTimeout: u32,
    dwSpeakerVolume: u32,
    dwSpeakerMode: u32,
    dwPreferredModemOptions: u32,
    dwNegotiatedModemOptions: u32,
    dwNegotiatedDCERate: u32,
    abVariablePortion: [1]u8,
};
type
  MODEMSETTINGS {.bycopy.} = object
    dwActualSize: uint32
    dwRequiredSize: uint32
    dwDevSpecificOffset: uint32
    dwDevSpecificSize: uint32
    dwCallSetupFailTimer: uint32
    dwInactivityTimeout: uint32
    dwSpeakerVolume: uint32
    dwSpeakerMode: uint32
    dwPreferredModemOptions: uint32
    dwNegotiatedModemOptions: uint32
    dwNegotiatedDCERate: uint32
    abVariablePortion: array[1, uint8]
struct MODEMSETTINGS
{
    uint dwActualSize;
    uint dwRequiredSize;
    uint dwDevSpecificOffset;
    uint dwDevSpecificSize;
    uint dwCallSetupFailTimer;
    uint dwInactivityTimeout;
    uint dwSpeakerVolume;
    uint dwSpeakerMode;
    uint dwPreferredModemOptions;
    uint dwNegotiatedModemOptions;
    uint dwNegotiatedDCERate;
    ubyte[1] abVariablePortion;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MODEMSETTINGS サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwActualSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwRequiredSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwDevSpecificOffset : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwDevSpecificSize : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwCallSetupFailTimer : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwInactivityTimeout : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwSpeakerVolume : MODEM_SPEAKER_VOLUME (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwSpeakerMode : MODEMSETTINGS_SPEAKER_MODE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwPreferredModemOptions : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwNegotiatedModemOptions : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwNegotiatedDCERate : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; abVariablePortion : BYTE (+44, 1byte)  varptr(st)+44 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MODEMSETTINGS
    #field int dwActualSize
    #field int dwRequiredSize
    #field int dwDevSpecificOffset
    #field int dwDevSpecificSize
    #field int dwCallSetupFailTimer
    #field int dwInactivityTimeout
    #field int dwSpeakerVolume
    #field int dwSpeakerMode
    #field int dwPreferredModemOptions
    #field int dwNegotiatedModemOptions
    #field int dwNegotiatedDCERate
    #field byte abVariablePortion 1
#endstruct

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