ホーム › UI.Accessibility › SERIALKEYSA
SERIALKEYSA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のサイズ(バイト)。 |
| dwFlags | SERIALKEYS_FLAGS | 4 | +4 | +4 | シリアルキー機能の動作を制御するフラグ群。 |
| lpszActivePort | LPSTR | 8/4 | +8 | +8 | 現在アクティブなポート名へのANSI文字列ポインタ。 |
| lpszPort | LPSTR | 8/4 | +16 | +12 | 使用するシリアルポート名へのANSI文字列ポインタ。 |
| iBaudRate | DWORD | 4 | +24 | +16 | シリアル接続のボーレート。 |
| iPortState | DWORD | 4 | +28 | +20 | ポートの状態を示す値。 |
| iActive | DWORD | 4 | +32 | +24 | シリアルキー機能が有効かを示す値。 |
各言語での定義
#include <windows.h>
// SERIALKEYSA (x64 40 / x86 28 バイト)
typedef struct SERIALKEYSA {
DWORD cbSize;
SERIALKEYS_FLAGS dwFlags;
LPSTR lpszActivePort;
LPSTR lpszPort;
DWORD iBaudRate;
DWORD iPortState;
DWORD iActive;
} SERIALKEYSA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SERIALKEYSA
{
public uint cbSize;
public uint dwFlags;
public IntPtr lpszActivePort;
public IntPtr lpszPort;
public uint iBaudRate;
public uint iPortState;
public uint iActive;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SERIALKEYSA
Public cbSize As UInteger
Public dwFlags As UInteger
Public lpszActivePort As IntPtr
Public lpszPort As IntPtr
Public iBaudRate As UInteger
Public iPortState As UInteger
Public iActive As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SERIALKEYSA(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("lpszActivePort", ctypes.c_void_p),
("lpszPort", ctypes.c_void_p),
("iBaudRate", wintypes.DWORD),
("iPortState", wintypes.DWORD),
("iActive", wintypes.DWORD),
]#[repr(C)]
pub struct SERIALKEYSA {
pub cbSize: u32,
pub dwFlags: u32,
pub lpszActivePort: *mut core::ffi::c_void,
pub lpszPort: *mut core::ffi::c_void,
pub iBaudRate: u32,
pub iPortState: u32,
pub iActive: u32,
}import "golang.org/x/sys/windows"
type SERIALKEYSA struct {
cbSize uint32
dwFlags uint32
lpszActivePort uintptr
lpszPort uintptr
iBaudRate uint32
iPortState uint32
iActive uint32
}type
SERIALKEYSA = record
cbSize: DWORD;
dwFlags: DWORD;
lpszActivePort: Pointer;
lpszPort: Pointer;
iBaudRate: DWORD;
iPortState: DWORD;
iActive: DWORD;
end;const SERIALKEYSA = extern struct {
cbSize: u32,
dwFlags: u32,
lpszActivePort: ?*anyopaque,
lpszPort: ?*anyopaque,
iBaudRate: u32,
iPortState: u32,
iActive: u32,
};type
SERIALKEYSA {.bycopy.} = object
cbSize: uint32
dwFlags: uint32
lpszActivePort: pointer
lpszPort: pointer
iBaudRate: uint32
iPortState: uint32
iActive: uint32struct SERIALKEYSA
{
uint cbSize;
uint dwFlags;
void* lpszActivePort;
void* lpszPort;
uint iBaudRate;
uint iPortState;
uint iActive;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SERIALKEYSA サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : SERIALKEYS_FLAGS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; lpszActivePort : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lpszPort : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; iBaudRate : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; iPortState : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; iActive : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SERIALKEYSA サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : SERIALKEYS_FLAGS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; lpszActivePort : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; lpszPort : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; iBaudRate : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; iPortState : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; iActive : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SERIALKEYSA
#field int cbSize
#field int dwFlags
#field intptr lpszActivePort
#field intptr lpszPort
#field int iBaudRate
#field int iPortState
#field int iActive
#endstruct
stdim st, SERIALKEYSA ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize