Win32 API 日本語リファレンス
ホームUI.Controls › MCHITTESTINFO

MCHITTESTINFO

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
ptPOINT8+4+4ヒットテストするクライアント座標の点(POINT)。
uHitMCHITTESTINFO_HIT_FLAGS4+12+12ヒットした月カレンダー部分を示すフラグ(MCHITTESTINFO_HIT_FLAGS、MCHT_*)。
stSYSTEMTIME16+16+16ヒットした位置に対応する日付(SYSTEMTIME)。
rcRECT16+32+32ヒットしたカレンダー部分の矩形(RECT)。
iOffsetINT4+48+48ヒットしたカレンダーのオフセット。
iRowINT4+52+52ヒットしたカレンダーの行インデックス。
iColINT4+56+56ヒットしたカレンダーの列インデックス。

各言語での定義

#include <windows.h>

// POINT  (x64 8 / x86 8 バイト)
typedef struct POINT {
    INT x;
    INT y;
} POINT;

// SYSTEMTIME  (x64 16 / x86 16 バイト)
typedef struct SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME;

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// MCHITTESTINFO  (x64 60 / x86 60 バイト)
typedef struct MCHITTESTINFO {
    DWORD cbSize;
    POINT pt;
    MCHITTESTINFO_HIT_FLAGS uHit;
    SYSTEMTIME st;
    RECT rc;
    INT iOffset;
    INT iRow;
    INT iCol;
} MCHITTESTINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
    public int x;
    public int y;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEMTIME
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDayOfWeek;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MCHITTESTINFO
{
    public uint cbSize;
    public POINT pt;
    public uint uHit;
    public SYSTEMTIME st;
    public RECT rc;
    public int iOffset;
    public int iRow;
    public int iCol;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
    Public x As Integer
    Public y As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEMTIME
    Public wYear As UShort
    Public wMonth As UShort
    Public wDayOfWeek As UShort
    Public wDay As UShort
    Public wHour As UShort
    Public wMinute As UShort
    Public wSecond As UShort
    Public wMilliseconds As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MCHITTESTINFO
    Public cbSize As UInteger
    Public pt As POINT
    Public uHit As UInteger
    Public st As SYSTEMTIME
    Public rc As RECT
    Public iOffset As Integer
    Public iRow As Integer
    Public iCol As Integer
End Structure
import ctypes
from ctypes import wintypes

class POINT(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
    ]

class SYSTEMTIME(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", ctypes.c_ushort),
        ("wDayOfWeek", ctypes.c_ushort),
        ("wDay", ctypes.c_ushort),
        ("wHour", ctypes.c_ushort),
        ("wMinute", ctypes.c_ushort),
        ("wSecond", ctypes.c_ushort),
        ("wMilliseconds", ctypes.c_ushort),
    ]

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class MCHITTESTINFO(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("pt", POINT),
        ("uHit", wintypes.DWORD),
        ("st", SYSTEMTIME),
        ("rc", RECT),
        ("iOffset", ctypes.c_int),
        ("iRow", ctypes.c_int),
        ("iCol", ctypes.c_int),
    ]
#[repr(C)]
pub struct POINT {
    pub x: i32,
    pub y: i32,
}

#[repr(C)]
pub struct SYSTEMTIME {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDayOfWeek: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}

#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct MCHITTESTINFO {
    pub cbSize: u32,
    pub pt: POINT,
    pub uHit: u32,
    pub st: SYSTEMTIME,
    pub rc: RECT,
    pub iOffset: i32,
    pub iRow: i32,
    pub iCol: i32,
}
import "golang.org/x/sys/windows"

type POINT struct {
	x int32
	y int32
}

type SYSTEMTIME struct {
	wYear uint16
	wMonth uint16
	wDayOfWeek uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type MCHITTESTINFO struct {
	cbSize uint32
	pt POINT
	uHit uint32
	st SYSTEMTIME
	rc RECT
	iOffset int32
	iRow int32
	iCol int32
}
type
  POINT = record
    x: Integer;
    y: Integer;
  end;

  SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;

  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  MCHITTESTINFO = record
    cbSize: DWORD;
    pt: POINT;
    uHit: DWORD;
    st: SYSTEMTIME;
    rc: RECT;
    iOffset: Integer;
    iRow: Integer;
    iCol: Integer;
  end;
const POINT = extern struct {
    x: i32,
    y: i32,
};

const SYSTEMTIME = extern struct {
    wYear: u16,
    wMonth: u16,
    wDayOfWeek: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};

const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const MCHITTESTINFO = extern struct {
    cbSize: u32,
    pt: POINT,
    uHit: u32,
    st: SYSTEMTIME,
    rc: RECT,
    iOffset: i32,
    iRow: i32,
    iCol: i32,
};
type
  POINT {.bycopy.} = object
    x: int32
    y: int32

  SYSTEMTIME {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDayOfWeek: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16

  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  MCHITTESTINFO {.bycopy.} = object
    cbSize: uint32
    pt: POINT
    uHit: uint32
    st: SYSTEMTIME
    rc: RECT
    iOffset: int32
    iRow: int32
    iCol: int32
struct POINT
{
    int x;
    int y;
}

struct SYSTEMTIME
{
    ushort wYear;
    ushort wMonth;
    ushort wDayOfWeek;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
}

struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct MCHITTESTINFO
{
    uint cbSize;
    POINT pt;
    uint uHit;
    SYSTEMTIME st;
    RECT rc;
    int iOffset;
    int iRow;
    int iCol;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MCHITTESTINFO サイズ: 60 バイト(x64)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pt : POINT (+4, 8byte)  varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; uHit : MCHITTESTINFO_HIT_FLAGS (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; st : SYSTEMTIME (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; rc : RECT (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; iOffset : INT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; iRow : INT (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; iCol : INT (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINT
    #field int x
    #field int y
#endstruct

#defstruct global SYSTEMTIME
    #field short wYear
    #field short wMonth
    #field short wDayOfWeek
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
#endstruct

#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global MCHITTESTINFO
    #field int cbSize
    #field POINT pt
    #field int uHit
    #field SYSTEMTIME st
    #field RECT rc
    #field int iOffset
    #field int iRow
    #field int iCol
#endstruct

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