ホーム › UI.WindowsAndMessaging › GUITHREADINFO
GUITHREADINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のサイズ(バイト数)である。呼び出し前に設定する。 |
| flags | GUITHREADINFO_FLAGS | 4 | +4 | +4 | スレッドの GUI 状態を示すフラグである(キャレットの表示状態など)。 |
| hwndActive | HWND | 8/4 | +8 | +8 | アクティブウィンドウのハンドルを受け取る。 |
| hwndFocus | HWND | 8/4 | +16 | +12 | キーボードフォーカスを持つウィンドウのハンドルを受け取る。 |
| hwndCapture | HWND | 8/4 | +24 | +16 | マウスキャプチャを持つウィンドウのハンドルを受け取る。 |
| hwndMenuOwner | HWND | 8/4 | +32 | +20 | メニューを所有するウィンドウのハンドルを受け取る。 |
| hwndMoveSize | HWND | 8/4 | +40 | +24 | 移動・サイズ変更モードにあるウィンドウのハンドルを受け取る。 |
| hwndCaret | HWND | 8/4 | +48 | +28 | キャレットを持つウィンドウのハンドルを受け取る。 |
| rcCaret | RECT | 16 | +56 | +32 | キャレットの境界矩形(クライアント座標)を受け取る。 |
各言語での定義
#include <windows.h>
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// GUITHREADINFO (x64 72 / x86 48 バイト)
typedef struct GUITHREADINFO {
DWORD cbSize;
GUITHREADINFO_FLAGS flags;
HWND hwndActive;
HWND hwndFocus;
HWND hwndCapture;
HWND hwndMenuOwner;
HWND hwndMoveSize;
HWND hwndCaret;
RECT rcCaret;
} GUITHREADINFO;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 GUITHREADINFO
{
public uint cbSize;
public uint flags;
public IntPtr hwndActive;
public IntPtr hwndFocus;
public IntPtr hwndCapture;
public IntPtr hwndMenuOwner;
public IntPtr hwndMoveSize;
public IntPtr hwndCaret;
public RECT rcCaret;
}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 GUITHREADINFO
Public cbSize As UInteger
Public flags As UInteger
Public hwndActive As IntPtr
Public hwndFocus As IntPtr
Public hwndCapture As IntPtr
Public hwndMenuOwner As IntPtr
Public hwndMoveSize As IntPtr
Public hwndCaret As IntPtr
Public rcCaret As RECT
End Structureimport 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 GUITHREADINFO(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("flags", wintypes.DWORD),
("hwndActive", ctypes.c_void_p),
("hwndFocus", ctypes.c_void_p),
("hwndCapture", ctypes.c_void_p),
("hwndMenuOwner", ctypes.c_void_p),
("hwndMoveSize", ctypes.c_void_p),
("hwndCaret", ctypes.c_void_p),
("rcCaret", RECT),
]#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct GUITHREADINFO {
pub cbSize: u32,
pub flags: u32,
pub hwndActive: *mut core::ffi::c_void,
pub hwndFocus: *mut core::ffi::c_void,
pub hwndCapture: *mut core::ffi::c_void,
pub hwndMenuOwner: *mut core::ffi::c_void,
pub hwndMoveSize: *mut core::ffi::c_void,
pub hwndCaret: *mut core::ffi::c_void,
pub rcCaret: RECT,
}import "golang.org/x/sys/windows"
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type GUITHREADINFO struct {
cbSize uint32
flags uint32
hwndActive uintptr
hwndFocus uintptr
hwndCapture uintptr
hwndMenuOwner uintptr
hwndMoveSize uintptr
hwndCaret uintptr
rcCaret RECT
}type
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
GUITHREADINFO = record
cbSize: DWORD;
flags: DWORD;
hwndActive: Pointer;
hwndFocus: Pointer;
hwndCapture: Pointer;
hwndMenuOwner: Pointer;
hwndMoveSize: Pointer;
hwndCaret: Pointer;
rcCaret: RECT;
end;const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const GUITHREADINFO = extern struct {
cbSize: u32,
flags: u32,
hwndActive: ?*anyopaque,
hwndFocus: ?*anyopaque,
hwndCapture: ?*anyopaque,
hwndMenuOwner: ?*anyopaque,
hwndMoveSize: ?*anyopaque,
hwndCaret: ?*anyopaque,
rcCaret: RECT,
};type
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
GUITHREADINFO {.bycopy.} = object
cbSize: uint32
flags: uint32
hwndActive: pointer
hwndFocus: pointer
hwndCapture: pointer
hwndMenuOwner: pointer
hwndMoveSize: pointer
hwndCaret: pointer
rcCaret: RECTstruct RECT
{
int left;
int top;
int right;
int bottom;
}
struct GUITHREADINFO
{
uint cbSize;
uint flags;
void* hwndActive;
void* hwndFocus;
void* hwndCapture;
void* hwndMenuOwner;
void* hwndMoveSize;
void* hwndCaret;
RECT rcCaret;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; GUITHREADINFO サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; flags : GUITHREADINFO_FLAGS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hwndActive : HWND (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; hwndFocus : HWND (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hwndCapture : HWND (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; hwndMenuOwner : HWND (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; hwndMoveSize : HWND (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hwndCaret : HWND (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; rcCaret : RECT (+32, 16byte) varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GUITHREADINFO サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; flags : GUITHREADINFO_FLAGS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hwndActive : HWND (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hwndFocus : HWND (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hwndCapture : HWND (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; hwndMenuOwner : HWND (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; hwndMoveSize : HWND (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; hwndCaret : HWND (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; rcCaret : RECT (+56, 16byte) varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; ※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 GUITHREADINFO
#field int cbSize
#field int flags
#field intptr hwndActive
#field intptr hwndFocus
#field intptr hwndCapture
#field intptr hwndMenuOwner
#field intptr hwndMoveSize
#field intptr hwndCaret
#field RECT rcCaret
#endstruct
stdim st, GUITHREADINFO ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize