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

LHITTESTINFO

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

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

フィールド

フィールドサイズx64x86説明
ptPOINT8+0+0ヒットテストするクライアント座標を表すPOINT。
itemLITEM4280+8+8命中したリンク項目の情報を受け取るLITEM構造体。

各言語での定義

#include <windows.h>

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

// LITEM  (x64 4280 / x86 4280 バイト)
typedef struct LITEM {
    LIST_ITEM_FLAGS mask;
    INT iLink;
    LIST_ITEM_STATE_FLAGS state;
    LIST_ITEM_STATE_FLAGS stateMask;
    WCHAR szID[48];
    WCHAR szUrl[2084];
} LITEM;

// LHITTESTINFO  (x64 4288 / x86 4288 バイト)
typedef struct LHITTESTINFO {
    POINT pt;
    LITEM item;
} LHITTESTINFO;
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 LITEM
{
    public uint mask;
    public int iLink;
    public uint state;
    public uint stateMask;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)] public string szID;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2084)] public string szUrl;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LHITTESTINFO
{
    public POINT pt;
    public LITEM item;
}
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 LITEM
    Public mask As UInteger
    Public iLink As Integer
    Public state As UInteger
    Public stateMask As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=48)> Public szID As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=2084)> Public szUrl As String
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LHITTESTINFO
    Public pt As POINT
    Public item As LITEM
End Structure
import ctypes
from ctypes import wintypes

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

class LITEM(ctypes.Structure):
    _fields_ = [
        ("mask", wintypes.DWORD),
        ("iLink", ctypes.c_int),
        ("state", wintypes.DWORD),
        ("stateMask", wintypes.DWORD),
        ("szID", ctypes.c_wchar * 48),
        ("szUrl", ctypes.c_wchar * 2084),
    ]

class LHITTESTINFO(ctypes.Structure):
    _fields_ = [
        ("pt", POINT),
        ("item", LITEM),
    ]
#[repr(C)]
pub struct POINT {
    pub x: i32,
    pub y: i32,
}

#[repr(C)]
pub struct LITEM {
    pub mask: u32,
    pub iLink: i32,
    pub state: u32,
    pub stateMask: u32,
    pub szID: [u16; 48],
    pub szUrl: [u16; 2084],
}

#[repr(C)]
pub struct LHITTESTINFO {
    pub pt: POINT,
    pub item: LITEM,
}
import "golang.org/x/sys/windows"

type POINT struct {
	x int32
	y int32
}

type LITEM struct {
	mask uint32
	iLink int32
	state uint32
	stateMask uint32
	szID [48]uint16
	szUrl [2084]uint16
}

type LHITTESTINFO struct {
	pt POINT
	item LITEM
}
type
  POINT = record
    x: Integer;
    y: Integer;
  end;

  LITEM = record
    mask: DWORD;
    iLink: Integer;
    state: DWORD;
    stateMask: DWORD;
    szID: array[0..47] of WideChar;
    szUrl: array[0..2083] of WideChar;
  end;

  LHITTESTINFO = record
    pt: POINT;
    item: LITEM;
  end;
const POINT = extern struct {
    x: i32,
    y: i32,
};

const LITEM = extern struct {
    mask: u32,
    iLink: i32,
    state: u32,
    stateMask: u32,
    szID: [48]u16,
    szUrl: [2084]u16,
};

const LHITTESTINFO = extern struct {
    pt: POINT,
    item: LITEM,
};
type
  POINT {.bycopy.} = object
    x: int32
    y: int32

  LITEM {.bycopy.} = object
    mask: uint32
    iLink: int32
    state: uint32
    stateMask: uint32
    szID: array[48, uint16]
    szUrl: array[2084, uint16]

  LHITTESTINFO {.bycopy.} = object
    pt: POINT
    item: LITEM
struct POINT
{
    int x;
    int y;
}

struct LITEM
{
    uint mask;
    int iLink;
    uint state;
    uint stateMask;
    wchar[48] szID;
    wchar[2084] szUrl;
}

struct LHITTESTINFO
{
    POINT pt;
    LITEM item;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LHITTESTINFO サイズ: 4288 バイト(x64)
dim st, 1072    ; 4byte整数×1072(構造体サイズ 4288 / 4 切り上げ)
; pt : POINT (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; item : LITEM (+8, 4280byte)  varptr(st)+8 を基点に操作(4280byte:入れ子/配列)
; ※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 LITEM
    #field int mask
    #field int iLink
    #field int state
    #field int stateMask
    #field wchar szID 48
    #field wchar szUrl 2084
#endstruct

#defstruct global LHITTESTINFO
    #field POINT pt
    #field LITEM item
#endstruct

stdim st, LHITTESTINFO        ; NSTRUCT 変数を確保