ホーム › UI.WindowsAndMessaging › CURSORSHAPE
CURSORSHAPE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| xHotSpot | INT | 4 | +0 | +0 | カーソルのホットスポットの x 座標である。 |
| yHotSpot | INT | 4 | +4 | +4 | カーソルのホットスポットの y 座標である。 |
| cx | INT | 4 | +8 | +8 | カーソルの幅(ピクセル)である。 |
| cy | INT | 4 | +12 | +12 | カーソルの高さ(ピクセル)である。 |
| cbWidth | INT | 4 | +16 | +16 | 1 走査線あたりのバイト数である。 |
| Planes | BYTE | 1 | +20 | +20 | ビットマップのカラープレーン数である。 |
| BitsPixel | BYTE | 1 | +21 | +21 | 1 ピクセルあたりのビット数である。 |
各言語での定義
#include <windows.h>
// CURSORSHAPE (x64 24 / x86 24 バイト)
typedef struct CURSORSHAPE {
INT xHotSpot;
INT yHotSpot;
INT cx;
INT cy;
INT cbWidth;
BYTE Planes;
BYTE BitsPixel;
} CURSORSHAPE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CURSORSHAPE
{
public int xHotSpot;
public int yHotSpot;
public int cx;
public int cy;
public int cbWidth;
public byte Planes;
public byte BitsPixel;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CURSORSHAPE
Public xHotSpot As Integer
Public yHotSpot As Integer
Public cx As Integer
Public cy As Integer
Public cbWidth As Integer
Public Planes As Byte
Public BitsPixel As Byte
End Structureimport ctypes
from ctypes import wintypes
class CURSORSHAPE(ctypes.Structure):
_fields_ = [
("xHotSpot", ctypes.c_int),
("yHotSpot", ctypes.c_int),
("cx", ctypes.c_int),
("cy", ctypes.c_int),
("cbWidth", ctypes.c_int),
("Planes", ctypes.c_ubyte),
("BitsPixel", ctypes.c_ubyte),
]#[repr(C)]
pub struct CURSORSHAPE {
pub xHotSpot: i32,
pub yHotSpot: i32,
pub cx: i32,
pub cy: i32,
pub cbWidth: i32,
pub Planes: u8,
pub BitsPixel: u8,
}import "golang.org/x/sys/windows"
type CURSORSHAPE struct {
xHotSpot int32
yHotSpot int32
cx int32
cy int32
cbWidth int32
Planes byte
BitsPixel byte
}type
CURSORSHAPE = record
xHotSpot: Integer;
yHotSpot: Integer;
cx: Integer;
cy: Integer;
cbWidth: Integer;
Planes: Byte;
BitsPixel: Byte;
end;const CURSORSHAPE = extern struct {
xHotSpot: i32,
yHotSpot: i32,
cx: i32,
cy: i32,
cbWidth: i32,
Planes: u8,
BitsPixel: u8,
};type
CURSORSHAPE {.bycopy.} = object
xHotSpot: int32
yHotSpot: int32
cx: int32
cy: int32
cbWidth: int32
Planes: uint8
BitsPixel: uint8struct CURSORSHAPE
{
int xHotSpot;
int yHotSpot;
int cx;
int cy;
int cbWidth;
ubyte Planes;
ubyte BitsPixel;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CURSORSHAPE サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; xHotSpot : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; yHotSpot : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cx : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cy : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cbWidth : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Planes : BYTE (+20, 1byte) poke st,20,値 / 値 = peek(st,20)
; BitsPixel : BYTE (+21, 1byte) poke st,21,値 / 値 = peek(st,21)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CURSORSHAPE
#field int xHotSpot
#field int yHotSpot
#field int cx
#field int cy
#field int cbWidth
#field byte Planes
#field byte BitsPixel
#endstruct
stdim st, CURSORSHAPE ; NSTRUCT 変数を確保
st->xHotSpot = 100
mes "xHotSpot=" + st->xHotSpot