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

MCGRIDINFO

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
dwPartMCGRIDINFO_PART4+4+4情報を取得するカレンダー部分(MCGRIDINFO_PART、MCGIP_*)。
dwFlagsMCGRIDINFO_FLAGS4+8+8取得する情報の種類を示すフラグ(MCGRIDINFO_FLAGS、MCGIF_*)。
iCalendarINT4+12+12対象カレンダーのインデックス。
iRowINT4+16+16対象部分の行インデックス。
iColINT4+20+20対象部分の列インデックス。
bSelectedBOOL4+24+24対象部分が選択されているかを示すブール値。
stStartSYSTEMTIME16+28+28対象部分の開始日付(SYSTEMTIME)。
stEndSYSTEMTIME16+44+44対象部分の終了日付(SYSTEMTIME)。
rcRECT16+60+60対象部分の矩形(RECT)。
pszNameLPWSTR8/4+80+76対象部分の名前を受け取るバッファ(Unicode)。
cchNameUINT_PTR8/4+88+80pszNameバッファの文字数。

各言語での定義

#include <windows.h>

// 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;

// MCGRIDINFO  (x64 96 / x86 84 バイト)
typedef struct MCGRIDINFO {
    DWORD cbSize;
    MCGRIDINFO_PART dwPart;
    MCGRIDINFO_FLAGS dwFlags;
    INT iCalendar;
    INT iRow;
    INT iCol;
    BOOL bSelected;
    SYSTEMTIME stStart;
    SYSTEMTIME stEnd;
    RECT rc;
    LPWSTR pszName;
    UINT_PTR cchName;
} MCGRIDINFO;
using System;
using System.Runtime.InteropServices;

[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 MCGRIDINFO
{
    public uint cbSize;
    public uint dwPart;
    public uint dwFlags;
    public int iCalendar;
    public int iRow;
    public int iCol;
    [MarshalAs(UnmanagedType.Bool)] public bool bSelected;
    public SYSTEMTIME stStart;
    public SYSTEMTIME stEnd;
    public RECT rc;
    public IntPtr pszName;
    public UIntPtr cchName;
}
Imports System.Runtime.InteropServices

<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 MCGRIDINFO
    Public cbSize As UInteger
    Public dwPart As UInteger
    Public dwFlags As UInteger
    Public iCalendar As Integer
    Public iRow As Integer
    Public iCol As Integer
    <MarshalAs(UnmanagedType.Bool)> Public bSelected As Boolean
    Public stStart As SYSTEMTIME
    Public stEnd As SYSTEMTIME
    Public rc As RECT
    Public pszName As IntPtr
    Public cchName As UIntPtr
End Structure
import ctypes
from ctypes import wintypes

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 MCGRIDINFO(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("dwPart", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("iCalendar", ctypes.c_int),
        ("iRow", ctypes.c_int),
        ("iCol", ctypes.c_int),
        ("bSelected", wintypes.BOOL),
        ("stStart", SYSTEMTIME),
        ("stEnd", SYSTEMTIME),
        ("rc", RECT),
        ("pszName", ctypes.c_void_p),
        ("cchName", ctypes.c_size_t),
    ]
#[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 MCGRIDINFO {
    pub cbSize: u32,
    pub dwPart: u32,
    pub dwFlags: u32,
    pub iCalendar: i32,
    pub iRow: i32,
    pub iCol: i32,
    pub bSelected: i32,
    pub stStart: SYSTEMTIME,
    pub stEnd: SYSTEMTIME,
    pub rc: RECT,
    pub pszName: *mut core::ffi::c_void,
    pub cchName: usize,
}
import "golang.org/x/sys/windows"

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 MCGRIDINFO struct {
	cbSize uint32
	dwPart uint32
	dwFlags uint32
	iCalendar int32
	iRow int32
	iCol int32
	bSelected int32
	stStart SYSTEMTIME
	stEnd SYSTEMTIME
	rc RECT
	pszName uintptr
	cchName uintptr
}
type
  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;

  MCGRIDINFO = record
    cbSize: DWORD;
    dwPart: DWORD;
    dwFlags: DWORD;
    iCalendar: Integer;
    iRow: Integer;
    iCol: Integer;
    bSelected: BOOL;
    stStart: SYSTEMTIME;
    stEnd: SYSTEMTIME;
    rc: RECT;
    pszName: Pointer;
    cchName: NativeUInt;
  end;
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 MCGRIDINFO = extern struct {
    cbSize: u32,
    dwPart: u32,
    dwFlags: u32,
    iCalendar: i32,
    iRow: i32,
    iCol: i32,
    bSelected: i32,
    stStart: SYSTEMTIME,
    stEnd: SYSTEMTIME,
    rc: RECT,
    pszName: ?*anyopaque,
    cchName: usize,
};
type
  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

  MCGRIDINFO {.bycopy.} = object
    cbSize: uint32
    dwPart: uint32
    dwFlags: uint32
    iCalendar: int32
    iRow: int32
    iCol: int32
    bSelected: int32
    stStart: SYSTEMTIME
    stEnd: SYSTEMTIME
    rc: RECT
    pszName: pointer
    cchName: uint
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 MCGRIDINFO
{
    uint cbSize;
    uint dwPart;
    uint dwFlags;
    int iCalendar;
    int iRow;
    int iCol;
    int bSelected;
    SYSTEMTIME stStart;
    SYSTEMTIME stEnd;
    RECT rc;
    void* pszName;
    size_t cchName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MCGRIDINFO サイズ: 84 バイト(x86)
dim st, 21    ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwPart : MCGRIDINFO_PART (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFlags : MCGRIDINFO_FLAGS (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; iCalendar : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; iRow : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iCol : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; bSelected : BOOL (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; stStart : SYSTEMTIME (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; stEnd : SYSTEMTIME (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; rc : RECT (+60, 16byte)  varptr(st)+60 を基点に操作(16byte:入れ子/配列)
; pszName : LPWSTR (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; cchName : UINT_PTR (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MCGRIDINFO サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwPart : MCGRIDINFO_PART (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFlags : MCGRIDINFO_FLAGS (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; iCalendar : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; iRow : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iCol : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; bSelected : BOOL (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; stStart : SYSTEMTIME (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; stEnd : SYSTEMTIME (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; rc : RECT (+60, 16byte)  varptr(st)+60 を基点に操作(16byte:入れ子/配列)
; pszName : LPWSTR (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; cchName : UINT_PTR (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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 MCGRIDINFO
    #field int cbSize
    #field int dwPart
    #field int dwFlags
    #field int iCalendar
    #field int iRow
    #field int iCol
    #field bool bSelected
    #field SYSTEMTIME stStart
    #field SYSTEMTIME stEnd
    #field RECT rc
    #field intptr pszName
    #field intptr cchName
#endstruct

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