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

VIDEO_CURSOR_ATTRIBUTES

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

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

フィールド

フィールドサイズx64x86説明
WidthWORD2+0+0カーソルの幅。
HeightWORD2+2+2カーソルの高さ。
ColumnSHORT2+4+4カーソルの列位置。
RowSHORT2+6+6カーソルの行位置。
RateBYTE1+8+8カーソルの点滅レート。
EnableBYTE1+9+9カーソル表示の有効/無効を示すフラグ。

各言語での定義

#include <windows.h>

// VIDEO_CURSOR_ATTRIBUTES  (x64 10 / x86 10 バイト)
typedef struct VIDEO_CURSOR_ATTRIBUTES {
    WORD Width;
    WORD Height;
    SHORT Column;
    SHORT Row;
    BYTE Rate;
    BYTE Enable;
} VIDEO_CURSOR_ATTRIBUTES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VIDEO_CURSOR_ATTRIBUTES
{
    public ushort Width;
    public ushort Height;
    public short Column;
    public short Row;
    public byte Rate;
    public byte Enable;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VIDEO_CURSOR_ATTRIBUTES
    Public Width As UShort
    Public Height As UShort
    Public Column As Short
    Public Row As Short
    Public Rate As Byte
    Public Enable As Byte
End Structure
import ctypes
from ctypes import wintypes

class VIDEO_CURSOR_ATTRIBUTES(ctypes.Structure):
    _fields_ = [
        ("Width", ctypes.c_ushort),
        ("Height", ctypes.c_ushort),
        ("Column", ctypes.c_short),
        ("Row", ctypes.c_short),
        ("Rate", ctypes.c_ubyte),
        ("Enable", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct VIDEO_CURSOR_ATTRIBUTES {
    pub Width: u16,
    pub Height: u16,
    pub Column: i16,
    pub Row: i16,
    pub Rate: u8,
    pub Enable: u8,
}
import "golang.org/x/sys/windows"

type VIDEO_CURSOR_ATTRIBUTES struct {
	Width uint16
	Height uint16
	Column int16
	Row int16
	Rate byte
	Enable byte
}
type
  VIDEO_CURSOR_ATTRIBUTES = record
    Width: Word;
    Height: Word;
    Column: Smallint;
    Row: Smallint;
    Rate: Byte;
    Enable: Byte;
  end;
const VIDEO_CURSOR_ATTRIBUTES = extern struct {
    Width: u16,
    Height: u16,
    Column: i16,
    Row: i16,
    Rate: u8,
    Enable: u8,
};
type
  VIDEO_CURSOR_ATTRIBUTES {.bycopy.} = object
    Width: uint16
    Height: uint16
    Column: int16
    Row: int16
    Rate: uint8
    Enable: uint8
struct VIDEO_CURSOR_ATTRIBUTES
{
    ushort Width;
    ushort Height;
    short Column;
    short Row;
    ubyte Rate;
    ubyte Enable;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VIDEO_CURSOR_ATTRIBUTES サイズ: 10 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 10 / 4 切り上げ)
; Width : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Height : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; Column : SHORT (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; Row : SHORT (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; Rate : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; Enable : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VIDEO_CURSOR_ATTRIBUTES
    #field short Width
    #field short Height
    #field short Column
    #field short Row
    #field byte Rate
    #field byte Enable
#endstruct

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