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

TTTOOLINFOW

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズをバイト単位で指定する。
uFlagsTOOLTIP_FLAGS4+4+4ツールの動作を制御するTTF_系フラグの組み合わせ。
hwndHWND8/4+8+8ツールを含むウィンドウ、または通知先ウィンドウのハンドル。
uIdUINT_PTR8/4+16+12ツールの識別子。TTF_IDISHWND時はウィンドウハンドルを表す。
rectRECT16+24+16ツールの境界矩形を表すRECT。TTF_IDISHWND未指定時に使う。
hinstHINSTANCE8/4+40+32テキストリソースを含むモジュールのインスタンスハンドル。
lpszTextLPWSTR8/4+48+36表示するテキストへのポインタ。LPSTR_TEXTCALLBACK可。
lParamLPARAM8/4+56+40ツールに関連付けるアプリケーション定義データ。
lpReservedvoid*8/4+64+44予約フィールド。

各言語での定義

#include <windows.h>

// 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;
using System;
using System.Runtime.InteropServices;

[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;
}
Imports System.Runtime.InteropServices

<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
import ctypes
from ctypes import wintypes

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),
    ]
#[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,
}
import "golang.org/x/sys/windows"

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
  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;
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,
};
type
  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
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;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TTTOOLINFOW サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; uFlags : TOOLTIP_FLAGS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hwnd : HWND (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; uId : UINT_PTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; rect : RECT (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; hinst : HINSTANCE (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; lpszText : LPWSTR (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; lParam : LPARAM (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; lpReserved : void* (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TTTOOLINFOW サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; uFlags : TOOLTIP_FLAGS (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hwnd : HWND (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; uId : UINT_PTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; rect : RECT (+24, 16byte)  varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; hinst : HINSTANCE (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; lpszText : LPWSTR (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; lParam : LPARAM (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lpReserved : void* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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

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