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ヒットテストの対象となるポイント。
uHitMCHITTESTINFO_HIT_FLAGS4+12+12

ヒットテスト操作の結果を表すビットフラグを受け取る出力メンバーです。この値は次のいずれかになります。

意味
MCHT_CALENDARBK
指定されたポイントはカレンダーの背景上にありました。
MCHT_CALENDARCONTROL
指定されたポイントはいずれのカレンダーにも含まれませんが、カレンダー コントロールの RECT の内側にあります。
MCHT_CALENDARDATE
指定されたポイントはカレンダー内の特定の日付上にありました。lpMCHitTest>st の SYSTEMTIME 構造体には、指定されたポイントの日付が設定されます。
MCHT_CALENDARDATEMIN
指定されたポイントはカレンダー内の最小の日付上にありました。
MCHT_CALENDARDATEMAX
指定されたポイントはカレンダー内の最大の日付上にありました。
MCHT_CALENDARDATENEXT
指定されたポイントは翌月の日付 (現在表示されている月の末尾に部分的に表示されているもの) の上にありました。ユーザーがここをクリックすると、月間予定表は表示を翌月または次の月のセットにスクロールします。
MCHT_CALENDARDATEPREV
指定されたポイントは前月の日付 (現在表示されている月の末尾に部分的に表示されているもの) の上にありました。ユーザーがここをクリックすると、月間予定表は表示を前月または前の月のセットにスクロールします。
MCHT_CALENDARDAY
指定されたポイントは曜日の略称 (たとえば「Fri」) の上にありました。 lpMCHitTest>st の SYSTEMTIME 構造体には、最上行の対応する日付が設定されます。
MCHT_CALENDARWEEKNUM
指定されたポイントは週番号 (MCS_WEEKNUMBERS スタイルの場合のみ) の上にありました。 lpMCHitTest>st の SYSTEMTIME 構造体には、左端の列の対応する日付が設定されます。
MCHT_NOWHERE
指定されたポイントは月間予定表コントロール上にないか、コントロールの非アクティブな部分にありました。
MCHT_TITLEBK
指定されたポイントは月のタイトルの背景上にありました。
MCHT_TITLEBTNNEXT
指定されたポイントはコントロールの右上隅にあるボタンの上にありました。ユーザーがここをクリックすると、月間予定表は表示を翌月または次の月のセットにスクロールします。
MCHT_TITLEBTNPREV
指定されたポイントはコントロールの左上隅にあるボタンの上にありました。ユーザーがここをクリックすると、月間予定表は表示を前月または前の月のセットにスクロールします。
MCHT_TITLEMONTH
指定されたポイントは月のタイトル バー内の、月名の上にありました。
MCHT_TITLEYEAR
指定されたポイントは月のタイトル バー内の、年の値の上にありました。
stSYSTEMTIME16+16+16ヒットテストされた位置に固有の日付と時刻の情報を受け取ります。
rcRECT16+32+32ヒットテストされた位置。
iOffsetINT4+48+48複数のカレンダーを表示している場合、ヒットテストされたポイントにあるカレンダーのオフセット (0 から始まる) です。
iRowINT4+52+52指定されたヒット ポイントが含まれるカレンダー グリッドの行番号です。 例: 月の 8 日をヒットテストし、その日がその月の 2 週目にある場合、行インデックスは 0 から始まるため iRow は 1 になります。
iColINT4+56+56指定されたポイントが含まれるカレンダー グリッドの列番号です。たとえば、週が日曜日から始まり、その月の 1 日が金曜日である場合、1 日をヒットテストすると iCol には 5 が返されます。0 から始まる列インデックスでは、金曜日は行の先頭から 5 番目の列にあるためです。

公式ドキュメント

月間予定表コントロールにおけるポイントのヒットテストに固有の情報を保持します。この構造体は MCM_HITTEST メッセージおよび対応する MonthCal_HitTest マクロと共に使用されます。

解説(Remarks)

このコントロールの列と行は 0 から始まるインデックス システムを使用します。つまり、最初の列または行のインデックスは 0 になります。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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