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

TTHITTESTINFOA

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

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

フィールド

フィールドサイズx64x86説明
hwndHWND8/4+0+0ヒットテスト対象のツールチップツールを含むウィンドウのハンドル。
ptPOINT8+8+4ヒットテストするクライアント座標を表すPOINT。
tiTTTOOLINFOA72/48+16+12命中したツールの情報を受け取るTTTOOLINFOA構造体。

各言語での定義

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

// TTTOOLINFOA  (x64 72 / x86 48 バイト)
typedef struct TTTOOLINFOA {
    DWORD cbSize;
    TOOLTIP_FLAGS uFlags;
    HWND hwnd;
    UINT_PTR uId;
    RECT rect;
    HINSTANCE hinst;
    LPSTR lpszText;
    LPARAM lParam;
    void* lpReserved;
} TTTOOLINFOA;

// TTHITTESTINFOA  (x64 88 / x86 60 バイト)
typedef struct TTHITTESTINFOA {
    HWND hwnd;
    POINT pt;
    TTTOOLINFOA ti;
} TTHITTESTINFOA;
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 TTTOOLINFOA
{
    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 TTHITTESTINFOA
{
    public IntPtr hwnd;
    public POINT pt;
    public TTTOOLINFOA 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 TTTOOLINFOA
    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 TTHITTESTINFOA
    Public hwnd As IntPtr
    Public pt As POINT
    Public ti As TTTOOLINFOA
End Structure
import 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 TTTOOLINFOA(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 TTHITTESTINFOA(ctypes.Structure):
    _fields_ = [
        ("hwnd", ctypes.c_void_p),
        ("pt", POINT),
        ("ti", TTTOOLINFOA),
    ]
#[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 TTTOOLINFOA {
    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 TTHITTESTINFOA {
    pub hwnd: *mut core::ffi::c_void,
    pub pt: POINT,
    pub ti: TTTOOLINFOA,
}
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 TTTOOLINFOA struct {
	cbSize uint32
	uFlags uint32
	hwnd uintptr
	uId uintptr
	rect RECT
	hinst uintptr
	lpszText uintptr
	lParam uintptr
	lpReserved uintptr
}

type TTHITTESTINFOA struct {
	hwnd uintptr
	pt POINT
	ti TTTOOLINFOA
}
type
  POINT = record
    x: Integer;
    y: Integer;
  end;

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

  TTTOOLINFOA = record
    cbSize: DWORD;
    uFlags: DWORD;
    hwnd: Pointer;
    uId: NativeUInt;
    rect: RECT;
    hinst: Pointer;
    lpszText: Pointer;
    lParam: NativeInt;
    lpReserved: Pointer;
  end;

  TTHITTESTINFOA = record
    hwnd: Pointer;
    pt: POINT;
    ti: TTTOOLINFOA;
  end;
const POINT = extern struct {
    x: i32,
    y: i32,
};

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

const TTTOOLINFOA = extern struct {
    cbSize: u32,
    uFlags: u32,
    hwnd: ?*anyopaque,
    uId: usize,
    rect: RECT,
    hinst: ?*anyopaque,
    lpszText: ?*anyopaque,
    lParam: isize,
    lpReserved: ?*anyopaque,
};

const TTHITTESTINFOA = extern struct {
    hwnd: ?*anyopaque,
    pt: POINT,
    ti: TTTOOLINFOA,
};
type
  POINT {.bycopy.} = object
    x: int32
    y: int32

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

  TTTOOLINFOA {.bycopy.} = object
    cbSize: uint32
    uFlags: uint32
    hwnd: pointer
    uId: uint
    rect: RECT
    hinst: pointer
    lpszText: pointer
    lParam: int
    lpReserved: pointer

  TTHITTESTINFOA {.bycopy.} = object
    hwnd: pointer
    pt: POINT
    ti: TTTOOLINFOA
struct POINT
{
    int x;
    int y;
}

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

struct TTTOOLINFOA
{
    uint cbSize;
    uint uFlags;
    void* hwnd;
    size_t uId;
    RECT rect;
    void* hinst;
    void* lpszText;
    ptrdiff_t lParam;
    void* lpReserved;
}

struct TTHITTESTINFOA
{
    void* hwnd;
    POINT pt;
    TTTOOLINFOA ti;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TTHITTESTINFOA サイズ: 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 : TTTOOLINFOA (+12, 48byte)  varptr(st)+12 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TTHITTESTINFOA サイズ: 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 : TTTOOLINFOA (+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 TTTOOLINFOA
    #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 TTHITTESTINFOA
    #field intptr hwnd
    #field POINT pt
    #field TTTOOLINFOA ti
#endstruct

stdim st, TTHITTESTINFOA        ; NSTRUCT 変数を確保