Win32 API 日本語リファレンス
ホームData.HtmlHelp › HH_POPUP

HH_POPUP

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

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

フィールド

フィールドサイズx64x86説明
cbStructINT4+0+0この構造体のサイズ(バイト)。バージョン識別に使う。
hinstHINSTANCE8/4+8+4テキストをリソースから取得する場合のインスタンスハンドル。
idStringDWORD4+16+8表示文字列をリソースから読み込む際の文字列ID。
pszTextCHAR*8/4+24+12ポップアップに表示するテキストへのポインタ(ASCII)。idStringより優先。
ptPOINT8+32+16ポップアップを表示する画面座標(POINT)。
clrForegroundCOLORREF4+40+24テキストの前景色(COLORREF)。-1で既定色。
clrBackgroundCOLORREF4+44+28ポップアップの背景色(COLORREF)。-1で既定色。
rcMarginsRECT16+48+32テキスト周囲の余白を指定する矩形(RECT)。各辺-1で既定。
pszFontCHAR*8/4+64+48使用するフォント名やサイズ等を記述した文字列へのポインタ(ASCII)。NULL可。

各言語での定義

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

// HH_POPUP  (x64 72 / x86 52 バイト)
typedef struct HH_POPUP {
    INT cbStruct;
    HINSTANCE hinst;
    DWORD idString;
    CHAR* pszText;
    POINT pt;
    COLORREF clrForeground;
    COLORREF clrBackground;
    RECT rcMargins;
    CHAR* pszFont;
} HH_POPUP;
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 HH_POPUP
{
    public int cbStruct;
    public IntPtr hinst;
    public uint idString;
    public IntPtr pszText;
    public POINT pt;
    public uint clrForeground;
    public uint clrBackground;
    public RECT rcMargins;
    public IntPtr pszFont;
}
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 HH_POPUP
    Public cbStruct As Integer
    Public hinst As IntPtr
    Public idString As UInteger
    Public pszText As IntPtr
    Public pt As POINT
    Public clrForeground As UInteger
    Public clrBackground As UInteger
    Public rcMargins As RECT
    Public pszFont As IntPtr
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 HH_POPUP(ctypes.Structure):
    _fields_ = [
        ("cbStruct", ctypes.c_int),
        ("hinst", ctypes.c_void_p),
        ("idString", wintypes.DWORD),
        ("pszText", ctypes.c_void_p),
        ("pt", POINT),
        ("clrForeground", wintypes.DWORD),
        ("clrBackground", wintypes.DWORD),
        ("rcMargins", RECT),
        ("pszFont", ctypes.c_void_p),
    ]
#[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 HH_POPUP {
    pub cbStruct: i32,
    pub hinst: *mut core::ffi::c_void,
    pub idString: u32,
    pub pszText: *mut core::ffi::c_void,
    pub pt: POINT,
    pub clrForeground: u32,
    pub clrBackground: u32,
    pub rcMargins: RECT,
    pub pszFont: *mut core::ffi::c_void,
}
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 HH_POPUP struct {
	cbStruct int32
	hinst uintptr
	idString uint32
	pszText uintptr
	pt POINT
	clrForeground uint32
	clrBackground uint32
	rcMargins RECT
	pszFont uintptr
}
type
  POINT = record
    x: Integer;
    y: Integer;
  end;

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

  HH_POPUP = record
    cbStruct: Integer;
    hinst: Pointer;
    idString: DWORD;
    pszText: Pointer;
    pt: POINT;
    clrForeground: DWORD;
    clrBackground: DWORD;
    rcMargins: RECT;
    pszFont: Pointer;
  end;
const POINT = extern struct {
    x: i32,
    y: i32,
};

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

const HH_POPUP = extern struct {
    cbStruct: i32,
    hinst: ?*anyopaque,
    idString: u32,
    pszText: ?*anyopaque,
    pt: POINT,
    clrForeground: u32,
    clrBackground: u32,
    rcMargins: RECT,
    pszFont: ?*anyopaque,
};
type
  POINT {.bycopy.} = object
    x: int32
    y: int32

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

  HH_POPUP {.bycopy.} = object
    cbStruct: int32
    hinst: pointer
    idString: uint32
    pszText: pointer
    pt: POINT
    clrForeground: uint32
    clrBackground: uint32
    rcMargins: RECT
    pszFont: pointer
struct POINT
{
    int x;
    int y;
}

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

struct HH_POPUP
{
    int cbStruct;
    void* hinst;
    uint idString;
    void* pszText;
    POINT pt;
    uint clrForeground;
    uint clrBackground;
    RECT rcMargins;
    void* pszFont;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; HH_POPUP サイズ: 52 バイト(x86)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; cbStruct : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hinst : HINSTANCE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; idString : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pszText : CHAR* (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pt : POINT (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; clrForeground : COLORREF (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; clrBackground : COLORREF (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; rcMargins : RECT (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; pszFont : CHAR* (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HH_POPUP サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; cbStruct : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hinst : HINSTANCE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; idString : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pszText : CHAR* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pt : POINT (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; clrForeground : COLORREF (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; clrBackground : COLORREF (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; rcMargins : RECT (+48, 16byte)  varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; pszFont : CHAR* (+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 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 HH_POPUP
    #field int cbStruct
    #field intptr hinst
    #field int idString
    #field intptr pszText
    #field POINT pt
    #field int clrForeground
    #field int clrBackground
    #field RECT rcMargins
    #field intptr pszFont
#endstruct

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