ホーム › UI.Controls › TTHITTESTINFOW
TTHITTESTINFOW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hwnd | HWND | 8/4 | +0 | +0 | ツール、または指定されたツールを持つウィンドウへのハンドルです。 |
| pt | POINT | 8 | +8 | +4 | テストする点のクライアント座標です。 |
| ti | TTTOOLINFOW | 72/48 | +16 | +12 | TOOLINFO 構造体です。 pt で指定した点が hwnd で指定したツール内にある場合、この構造体はそのツールに関する情報を受け取ります。この構造体の cbSize メンバーは、このメッセージを送信する前に設定しておく必要があります。 |
公式ドキュメント
ツールチップコントロールが、指定されたツールの境界矩形内に点が含まれるかどうかを判断するために使用する情報を格納します。点が矩形内にある場合、この構造体はそのツールに関する情報を受け取ります。
解説(Remarks)
この構造体は TTM_HITTEST メッセージで使用します。
メモ
commctrl.h ヘッダーは、UNICODE プリプロセッサ定数の定義に応じて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして TTHITTESTINFO を定義しています。エンコーディング非依存のエイリアスと、エンコーディング非依存でないコードを混在させると不一致が生じ、コンパイルエラーや実行時エラーの原因となる可能性があります。詳細については、関数プロトタイプの規約を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// TTTOOLINFOW (x64 72 / x86 48 バイト)
typedef struct TTTOOLINFOW {
DWORD cbSize;
TOOLTIP_FLAGS uFlags;
HWND hwnd;
UINT_PTR uId;
RECT rect;
HINSTANCE hinst;
LPWSTR lpszText;
LPARAM lParam;
void* lpReserved;
} TTTOOLINFOW;
// TTHITTESTINFOW (x64 88 / x86 60 バイト)
typedef struct TTHITTESTINFOW {
HWND hwnd;
POINT pt;
TTTOOLINFOW ti;
} TTHITTESTINFOW;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 RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TTTOOLINFOW
{
public uint cbSize;
public uint uFlags;
public IntPtr hwnd;
public UIntPtr uId;
public RECT rect;
public IntPtr hinst;
public IntPtr lpszText;
public IntPtr lParam;
public IntPtr lpReserved;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TTHITTESTINFOW
{
public IntPtr hwnd;
public POINT pt;
public TTTOOLINFOW ti;
}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 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 TTTOOLINFOW
Public cbSize As UInteger
Public uFlags As UInteger
Public hwnd As IntPtr
Public uId As UIntPtr
Public rect As RECT
Public hinst As IntPtr
Public lpszText As IntPtr
Public lParam As IntPtr
Public lpReserved As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TTHITTESTINFOW
Public hwnd As IntPtr
Public pt As POINT
Public ti As TTTOOLINFOW
End Structureimport ctypes
from ctypes import wintypes
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class RECT(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class TTTOOLINFOW(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("uFlags", wintypes.DWORD),
("hwnd", ctypes.c_void_p),
("uId", ctypes.c_size_t),
("rect", RECT),
("hinst", ctypes.c_void_p),
("lpszText", ctypes.c_void_p),
("lParam", ctypes.c_ssize_t),
("lpReserved", ctypes.c_void_p),
]
class TTHITTESTINFOW(ctypes.Structure):
_fields_ = [
("hwnd", ctypes.c_void_p),
("pt", POINT),
("ti", TTTOOLINFOW),
]#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct TTTOOLINFOW {
pub cbSize: u32,
pub uFlags: u32,
pub hwnd: *mut core::ffi::c_void,
pub uId: usize,
pub rect: RECT,
pub hinst: *mut core::ffi::c_void,
pub lpszText: *mut core::ffi::c_void,
pub lParam: isize,
pub lpReserved: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct TTHITTESTINFOW {
pub hwnd: *mut core::ffi::c_void,
pub pt: POINT,
pub ti: TTTOOLINFOW,
}import "golang.org/x/sys/windows"
type POINT struct {
x int32
y int32
}
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type TTTOOLINFOW struct {
cbSize uint32
uFlags uint32
hwnd uintptr
uId uintptr
rect RECT
hinst uintptr
lpszText uintptr
lParam uintptr
lpReserved uintptr
}
type TTHITTESTINFOW struct {
hwnd uintptr
pt POINT
ti TTTOOLINFOW
}type
POINT = record
x: Integer;
y: Integer;
end;
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
TTTOOLINFOW = record
cbSize: DWORD;
uFlags: DWORD;
hwnd: Pointer;
uId: NativeUInt;
rect: RECT;
hinst: Pointer;
lpszText: Pointer;
lParam: NativeInt;
lpReserved: Pointer;
end;
TTHITTESTINFOW = record
hwnd: Pointer;
pt: POINT;
ti: TTTOOLINFOW;
end;const POINT = extern struct {
x: i32,
y: i32,
};
const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const TTTOOLINFOW = extern struct {
cbSize: u32,
uFlags: u32,
hwnd: ?*anyopaque,
uId: usize,
rect: RECT,
hinst: ?*anyopaque,
lpszText: ?*anyopaque,
lParam: isize,
lpReserved: ?*anyopaque,
};
const TTHITTESTINFOW = extern struct {
hwnd: ?*anyopaque,
pt: POINT,
ti: TTTOOLINFOW,
};type
POINT {.bycopy.} = object
x: int32
y: int32
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
TTTOOLINFOW {.bycopy.} = object
cbSize: uint32
uFlags: uint32
hwnd: pointer
uId: uint
rect: RECT
hinst: pointer
lpszText: pointer
lParam: int
lpReserved: pointer
TTHITTESTINFOW {.bycopy.} = object
hwnd: pointer
pt: POINT
ti: TTTOOLINFOWstruct POINT
{
int x;
int y;
}
struct RECT
{
int left;
int top;
int right;
int bottom;
}
struct TTTOOLINFOW
{
uint cbSize;
uint uFlags;
void* hwnd;
size_t uId;
RECT rect;
void* hinst;
void* lpszText;
ptrdiff_t lParam;
void* lpReserved;
}
struct TTHITTESTINFOW
{
void* hwnd;
POINT pt;
TTTOOLINFOW ti;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TTHITTESTINFOW サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; hwnd : HWND (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pt : POINT (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; ti : TTTOOLINFOW (+12, 48byte) varptr(st)+12 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TTHITTESTINFOW サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; hwnd : HWND (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; pt : POINT (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ti : TTTOOLINFOW (+16, 72byte) varptr(st)+16 を基点に操作(72byte:入れ子/配列)
; ※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 RECT
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global TTTOOLINFOW
#field int cbSize
#field int uFlags
#field intptr hwnd
#field intptr uId
#field RECT rect
#field intptr hinst
#field intptr lpszText
#field intptr lParam
#field intptr lpReserved
#endstruct
#defstruct global TTHITTESTINFOW
#field intptr hwnd
#field POINT pt
#field TTTOOLINFOW ti
#endstruct
stdim st, TTHITTESTINFOW ; NSTRUCT 変数を確保