PHONEBUTTONINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwTotalSize | DWORD | 4 | +0 | +0 | このデータ構造に割り当てられた合計サイズ (バイト単位)。 |
| dwNeededSize | DWORD | 4 | +4 | +4 | 返されるすべての情報を保持するために必要な、このデータ構造のサイズ (バイト単位)。 |
| dwUsedSize | DWORD | 4 | +8 | +8 | このデータ構造のうち、有用な情報が格納されている部分のサイズ (バイト単位)。 |
| dwButtonMode | DWORD | 4 | +12 | +12 | ボタンのモード、または一般的な用途の分類。このメンバーは PHONEBUTTONMODE_ Constants のいずれかを使用します。 |
| dwButtonFunction | DWORD | 4 | +16 | +16 | ボタンに割り当てられている機能。このメンバーは PHONEBUTTONFUNCTION_ Constants のいずれかを使用します。 |
| dwButtonTextSize | DWORD | 4 | +20 | +20 | ボタンの説明テキストのサイズ (バイト単位)。 |
| dwButtonTextOffset | DWORD | 4 | +24 | +24 | この構造体の先頭から、このボタンの説明テキストを格納する可変サイズのフィールドまでのオフセット。この情報の形式は、電話デバイスのデバイス機能の dwStringFormat メンバーで指定されたとおりです。フィールドのサイズは dwButtonTextSize で指定します。 |
| dwDevSpecificSize | DWORD | 4 | +28 | +28 | デバイス固有フィールドのサイズ (バイト単位)。デバイス固有フィールドが文字列へのポインターである場合、サイズには null 終端文字を含める必要があります。 |
| dwDevSpecificOffset | DWORD | 4 | +32 | +32 | 構造体の先頭から、可変サイズのデバイス固有フィールドまでのオフセット。フィールドのサイズは dwDevSpecificSize で指定します。 |
| dwButtonState | DWORD | 4 | +36 | +36 | phoneGetButtonInfo 関数の場合、このフィールドは PHONEBUTTONSTATE_ Constants を使用してボタンの現在の状態を示します。このフィールドは phoneSetButtonInfo 関数では無視されます。 |
公式ドキュメント
PHONEBUTTONINFO 構造体は、電話デバイス上のボタンに関する情報を格納します。この構造体は複数の TAPI および TSPI 関数で使用されます。
解説(Remarks)
デバイス固有の拡張には、このデータ構造の DevSpecific (dwDevSpecificSize および dwDevSpecificOffset) の可変サイズ領域を使用してください。
古いアプリケーションは、 PHONEBUTTONINFO 構造体にこのフィールドが含まれない状態でコンパイルされており、新しいサイズよりも小さい SIZEOF PHONEBUTTONINFO を使用します。アプリケーションは phoneOpen 関数で dwAPIVersion パラメーターを渡します。TAPI はこの状況に対処する際の判断材料としてこれを使用できます。指定された dwAPIVersion で定義されている構造体の固定部分のサイズより小さい dwTotalSize をアプリケーションが渡した場合は、PHONEERR_STRUCTURETOOSMALL が返されます。 TSPI_phoneGetButtonInfo 関数を呼び出す前にアプリケーションが十分なメモリを割り当てていた場合、TAPI は dwNeededSize メンバーと dwUsedSize メンバーに、指定された API バージョンにおける構造体の固定部分のサイズを設定します。
新しいサービス プロバイダー (新しい API バージョンをサポートするもの) は、渡された API バージョンを確認する必要があります。API バージョンがプロバイダーのサポートする最も高いバージョンより低い場合、サービス プロバイダーは古い API バージョンでサポートされていないフィールドに値を格納してはなりません。それらは古い構造体では可変部分に該当するためです。
新しいアプリケーションは、ネゴシエートされた API バージョンを常に意識し、そのバージョンにおける構造体の固定部分の本来の末尾を超えるフィールドの内容を参照してはなりません。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// PHONEBUTTONINFO (x64 40 / x86 40 バイト)
#pragma pack(push, 1)
typedef struct PHONEBUTTONINFO {
DWORD dwTotalSize;
DWORD dwNeededSize;
DWORD dwUsedSize;
DWORD dwButtonMode;
DWORD dwButtonFunction;
DWORD dwButtonTextSize;
DWORD dwButtonTextOffset;
DWORD dwDevSpecificSize;
DWORD dwDevSpecificOffset;
DWORD dwButtonState;
} PHONEBUTTONINFO;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct PHONEBUTTONINFO
{
public uint dwTotalSize;
public uint dwNeededSize;
public uint dwUsedSize;
public uint dwButtonMode;
public uint dwButtonFunction;
public uint dwButtonTextSize;
public uint dwButtonTextOffset;
public uint dwDevSpecificSize;
public uint dwDevSpecificOffset;
public uint dwButtonState;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure PHONEBUTTONINFO
Public dwTotalSize As UInteger
Public dwNeededSize As UInteger
Public dwUsedSize As UInteger
Public dwButtonMode As UInteger
Public dwButtonFunction As UInteger
Public dwButtonTextSize As UInteger
Public dwButtonTextOffset As UInteger
Public dwDevSpecificSize As UInteger
Public dwDevSpecificOffset As UInteger
Public dwButtonState As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PHONEBUTTONINFO(ctypes.Structure):
_pack_ = 1
_fields_ = [
("dwTotalSize", wintypes.DWORD),
("dwNeededSize", wintypes.DWORD),
("dwUsedSize", wintypes.DWORD),
("dwButtonMode", wintypes.DWORD),
("dwButtonFunction", wintypes.DWORD),
("dwButtonTextSize", wintypes.DWORD),
("dwButtonTextOffset", wintypes.DWORD),
("dwDevSpecificSize", wintypes.DWORD),
("dwDevSpecificOffset", wintypes.DWORD),
("dwButtonState", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct PHONEBUTTONINFO {
pub dwTotalSize: u32,
pub dwNeededSize: u32,
pub dwUsedSize: u32,
pub dwButtonMode: u32,
pub dwButtonFunction: u32,
pub dwButtonTextSize: u32,
pub dwButtonTextOffset: u32,
pub dwDevSpecificSize: u32,
pub dwDevSpecificOffset: u32,
pub dwButtonState: u32,
}import "golang.org/x/sys/windows"
type PHONEBUTTONINFO struct {
dwTotalSize uint32
dwNeededSize uint32
dwUsedSize uint32
dwButtonMode uint32
dwButtonFunction uint32
dwButtonTextSize uint32
dwButtonTextOffset uint32
dwDevSpecificSize uint32
dwDevSpecificOffset uint32
dwButtonState uint32
}type
PHONEBUTTONINFO = packed record
dwTotalSize: DWORD;
dwNeededSize: DWORD;
dwUsedSize: DWORD;
dwButtonMode: DWORD;
dwButtonFunction: DWORD;
dwButtonTextSize: DWORD;
dwButtonTextOffset: DWORD;
dwDevSpecificSize: DWORD;
dwDevSpecificOffset: DWORD;
dwButtonState: DWORD;
end;const PHONEBUTTONINFO = extern struct {
dwTotalSize: u32,
dwNeededSize: u32,
dwUsedSize: u32,
dwButtonMode: u32,
dwButtonFunction: u32,
dwButtonTextSize: u32,
dwButtonTextOffset: u32,
dwDevSpecificSize: u32,
dwDevSpecificOffset: u32,
dwButtonState: u32,
};type
PHONEBUTTONINFO {.packed.} = object
dwTotalSize: uint32
dwNeededSize: uint32
dwUsedSize: uint32
dwButtonMode: uint32
dwButtonFunction: uint32
dwButtonTextSize: uint32
dwButtonTextOffset: uint32
dwDevSpecificSize: uint32
dwDevSpecificOffset: uint32
dwButtonState: uint32align(1)
struct PHONEBUTTONINFO
{
uint dwTotalSize;
uint dwNeededSize;
uint dwUsedSize;
uint dwButtonMode;
uint dwButtonFunction;
uint dwButtonTextSize;
uint dwButtonTextOffset;
uint dwDevSpecificSize;
uint dwDevSpecificOffset;
uint dwButtonState;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PHONEBUTTONINFO サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwTotalSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwNeededSize : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwUsedSize : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwButtonMode : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwButtonFunction : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwButtonTextSize : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwButtonTextOffset : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwDevSpecificSize : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwDevSpecificOffset : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwButtonState : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PHONEBUTTONINFO, pack=1
#field int dwTotalSize
#field int dwNeededSize
#field int dwUsedSize
#field int dwButtonMode
#field int dwButtonFunction
#field int dwButtonTextSize
#field int dwButtonTextOffset
#field int dwDevSpecificSize
#field int dwDevSpecificOffset
#field int dwButtonState
#endstruct
stdim st, PHONEBUTTONINFO ; NSTRUCT 変数を確保
st->dwTotalSize = 100
mes "dwTotalSize=" + st->dwTotalSize