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

LINEMEDIACONTROLTONE

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

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

フィールド

フィールドサイズx64x86説明
dwAppSpecificDWORD4+0+0アプリが自由に使用できるトーン識別用の値。
dwDurationDWORD4+4+4トーンと判定するための継続時間をミリ秒で表す。
dwFrequency1DWORD4+8+8検出対象トーンの第1周波数をヘルツで表す。
dwFrequency2DWORD4+12+12検出対象トーンの第2周波数をヘルツで表す。0で未使用。
dwFrequency3DWORD4+16+16検出対象トーンの第3周波数をヘルツで表す。0で未使用。
dwMediaControlDWORD4+20+20トーン検出時に実行するメディア制御動作を示す値。

各言語での定義

#include <windows.h>

// LINEMEDIACONTROLTONE  (x64 24 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct LINEMEDIACONTROLTONE {
    DWORD dwAppSpecific;
    DWORD dwDuration;
    DWORD dwFrequency1;
    DWORD dwFrequency2;
    DWORD dwFrequency3;
    DWORD dwMediaControl;
} LINEMEDIACONTROLTONE;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct LINEMEDIACONTROLTONE
{
    public uint dwAppSpecific;
    public uint dwDuration;
    public uint dwFrequency1;
    public uint dwFrequency2;
    public uint dwFrequency3;
    public uint dwMediaControl;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure LINEMEDIACONTROLTONE
    Public dwAppSpecific As UInteger
    Public dwDuration As UInteger
    Public dwFrequency1 As UInteger
    Public dwFrequency2 As UInteger
    Public dwFrequency3 As UInteger
    Public dwMediaControl As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LINEMEDIACONTROLTONE(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwAppSpecific", wintypes.DWORD),
        ("dwDuration", wintypes.DWORD),
        ("dwFrequency1", wintypes.DWORD),
        ("dwFrequency2", wintypes.DWORD),
        ("dwFrequency3", wintypes.DWORD),
        ("dwMediaControl", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct LINEMEDIACONTROLTONE {
    pub dwAppSpecific: u32,
    pub dwDuration: u32,
    pub dwFrequency1: u32,
    pub dwFrequency2: u32,
    pub dwFrequency3: u32,
    pub dwMediaControl: u32,
}
import "golang.org/x/sys/windows"

type LINEMEDIACONTROLTONE struct {
	dwAppSpecific uint32
	dwDuration uint32
	dwFrequency1 uint32
	dwFrequency2 uint32
	dwFrequency3 uint32
	dwMediaControl uint32
}
type
  LINEMEDIACONTROLTONE = packed record
    dwAppSpecific: DWORD;
    dwDuration: DWORD;
    dwFrequency1: DWORD;
    dwFrequency2: DWORD;
    dwFrequency3: DWORD;
    dwMediaControl: DWORD;
  end;
const LINEMEDIACONTROLTONE = extern struct {
    dwAppSpecific: u32,
    dwDuration: u32,
    dwFrequency1: u32,
    dwFrequency2: u32,
    dwFrequency3: u32,
    dwMediaControl: u32,
};
type
  LINEMEDIACONTROLTONE {.packed.} = object
    dwAppSpecific: uint32
    dwDuration: uint32
    dwFrequency1: uint32
    dwFrequency2: uint32
    dwFrequency3: uint32
    dwMediaControl: uint32
align(1)
struct LINEMEDIACONTROLTONE
{
    uint dwAppSpecific;
    uint dwDuration;
    uint dwFrequency1;
    uint dwFrequency2;
    uint dwFrequency3;
    uint dwMediaControl;
}

HSP用 定義

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

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

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