CMINVOKECOMMANDINFOEX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。呼び出し前に設定する必要がある。 |
| fMask | DWORD | 4 | +4 | +4 | 動作を制御するフラグ(CMIC_MASK_定数)。 |
| hwnd | HWND | 8/4 | +8 | +8 | UI表示時の親ウィンドウのハンドル。 |
| lpVerb | LPSTR | 8/4 | +16 | +12 | 実行するコマンドの動詞または序数(ANSI)。 |
| lpParameters | LPSTR | 8/4 | +24 | +16 | コマンドに渡す追加引数(ANSI)。NULL可。 |
| lpDirectory | LPSTR | 8/4 | +32 | +20 | 作業ディレクトリ(ANSI)。NULL可。 |
| nShow | INT | 4 | +40 | +24 | 起動アプリのウィンドウ表示状態(SW_定数)。 |
| dwHotKey | DWORD | 4 | +44 | +28 | 割り当てるホットキー。 |
| hIcon | HANDLE | 8/4 | +48 | +32 | 関連付けるアイコンのハンドル。 |
| lpTitle | LPSTR | 8/4 | +56 | +36 | コマンドのタイトル文字列(ANSI)。 |
| lpVerbW | LPWSTR | 8/4 | +64 | +40 | 実行するコマンドの動詞(Unicode)。CMIC_MASK_UNICODE時に使用。 |
| lpParametersW | LPWSTR | 8/4 | +72 | +44 | コマンドに渡す追加引数(Unicode)。 |
| lpDirectoryW | LPWSTR | 8/4 | +80 | +48 | 作業ディレクトリ(Unicode)。 |
| lpTitleW | LPWSTR | 8/4 | +88 | +52 | コマンドのタイトル文字列(Unicode)。 |
| ptInvoke | POINT | 8 | +96 | +56 | コマンド呼び出し位置の座標(POINT)。CMIC_MASK_PTINVOKE時に使用。 |
各言語での定義
#include <windows.h>
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// CMINVOKECOMMANDINFOEX (x64 104 / x86 64 バイト)
typedef struct CMINVOKECOMMANDINFOEX {
DWORD cbSize;
DWORD fMask;
HWND hwnd;
LPSTR lpVerb;
LPSTR lpParameters;
LPSTR lpDirectory;
INT nShow;
DWORD dwHotKey;
HANDLE hIcon;
LPSTR lpTitle;
LPWSTR lpVerbW;
LPWSTR lpParametersW;
LPWSTR lpDirectoryW;
LPWSTR lpTitleW;
POINT ptInvoke;
} CMINVOKECOMMANDINFOEX;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 CMINVOKECOMMANDINFOEX
{
public uint cbSize;
public uint fMask;
public IntPtr hwnd;
public IntPtr lpVerb;
public IntPtr lpParameters;
public IntPtr lpDirectory;
public int nShow;
public uint dwHotKey;
public IntPtr hIcon;
public IntPtr lpTitle;
public IntPtr lpVerbW;
public IntPtr lpParametersW;
public IntPtr lpDirectoryW;
public IntPtr lpTitleW;
public POINT ptInvoke;
}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 CMINVOKECOMMANDINFOEX
Public cbSize As UInteger
Public fMask As UInteger
Public hwnd As IntPtr
Public lpVerb As IntPtr
Public lpParameters As IntPtr
Public lpDirectory As IntPtr
Public nShow As Integer
Public dwHotKey As UInteger
Public hIcon As IntPtr
Public lpTitle As IntPtr
Public lpVerbW As IntPtr
Public lpParametersW As IntPtr
Public lpDirectoryW As IntPtr
Public lpTitleW As IntPtr
Public ptInvoke As POINT
End Structureimport ctypes
from ctypes import wintypes
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class CMINVOKECOMMANDINFOEX(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("fMask", wintypes.DWORD),
("hwnd", ctypes.c_void_p),
("lpVerb", ctypes.c_void_p),
("lpParameters", ctypes.c_void_p),
("lpDirectory", ctypes.c_void_p),
("nShow", ctypes.c_int),
("dwHotKey", wintypes.DWORD),
("hIcon", ctypes.c_void_p),
("lpTitle", ctypes.c_void_p),
("lpVerbW", ctypes.c_void_p),
("lpParametersW", ctypes.c_void_p),
("lpDirectoryW", ctypes.c_void_p),
("lpTitleW", ctypes.c_void_p),
("ptInvoke", POINT),
]#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C)]
pub struct CMINVOKECOMMANDINFOEX {
pub cbSize: u32,
pub fMask: u32,
pub hwnd: *mut core::ffi::c_void,
pub lpVerb: *mut core::ffi::c_void,
pub lpParameters: *mut core::ffi::c_void,
pub lpDirectory: *mut core::ffi::c_void,
pub nShow: i32,
pub dwHotKey: u32,
pub hIcon: *mut core::ffi::c_void,
pub lpTitle: *mut core::ffi::c_void,
pub lpVerbW: *mut core::ffi::c_void,
pub lpParametersW: *mut core::ffi::c_void,
pub lpDirectoryW: *mut core::ffi::c_void,
pub lpTitleW: *mut core::ffi::c_void,
pub ptInvoke: POINT,
}import "golang.org/x/sys/windows"
type POINT struct {
x int32
y int32
}
type CMINVOKECOMMANDINFOEX struct {
cbSize uint32
fMask uint32
hwnd uintptr
lpVerb uintptr
lpParameters uintptr
lpDirectory uintptr
nShow int32
dwHotKey uint32
hIcon uintptr
lpTitle uintptr
lpVerbW uintptr
lpParametersW uintptr
lpDirectoryW uintptr
lpTitleW uintptr
ptInvoke POINT
}type
POINT = record
x: Integer;
y: Integer;
end;
CMINVOKECOMMANDINFOEX = record
cbSize: DWORD;
fMask: DWORD;
hwnd: Pointer;
lpVerb: Pointer;
lpParameters: Pointer;
lpDirectory: Pointer;
nShow: Integer;
dwHotKey: DWORD;
hIcon: Pointer;
lpTitle: Pointer;
lpVerbW: Pointer;
lpParametersW: Pointer;
lpDirectoryW: Pointer;
lpTitleW: Pointer;
ptInvoke: POINT;
end;const POINT = extern struct {
x: i32,
y: i32,
};
const CMINVOKECOMMANDINFOEX = extern struct {
cbSize: u32,
fMask: u32,
hwnd: ?*anyopaque,
lpVerb: ?*anyopaque,
lpParameters: ?*anyopaque,
lpDirectory: ?*anyopaque,
nShow: i32,
dwHotKey: u32,
hIcon: ?*anyopaque,
lpTitle: ?*anyopaque,
lpVerbW: ?*anyopaque,
lpParametersW: ?*anyopaque,
lpDirectoryW: ?*anyopaque,
lpTitleW: ?*anyopaque,
ptInvoke: POINT,
};type
POINT {.bycopy.} = object
x: int32
y: int32
CMINVOKECOMMANDINFOEX {.bycopy.} = object
cbSize: uint32
fMask: uint32
hwnd: pointer
lpVerb: pointer
lpParameters: pointer
lpDirectory: pointer
nShow: int32
dwHotKey: uint32
hIcon: pointer
lpTitle: pointer
lpVerbW: pointer
lpParametersW: pointer
lpDirectoryW: pointer
lpTitleW: pointer
ptInvoke: POINTstruct POINT
{
int x;
int y;
}
struct CMINVOKECOMMANDINFOEX
{
uint cbSize;
uint fMask;
void* hwnd;
void* lpVerb;
void* lpParameters;
void* lpDirectory;
int nShow;
uint dwHotKey;
void* hIcon;
void* lpTitle;
void* lpVerbW;
void* lpParametersW;
void* lpDirectoryW;
void* lpTitleW;
POINT ptInvoke;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CMINVOKECOMMANDINFOEX サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fMask : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hwnd : HWND (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lpVerb : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; lpParameters : LPSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lpDirectory : LPSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; nShow : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwHotKey : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; hIcon : HANDLE (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lpTitle : LPSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; lpVerbW : LPWSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; lpParametersW : LPWSTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; lpDirectoryW : LPWSTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; lpTitleW : LPWSTR (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ptInvoke : POINT (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CMINVOKECOMMANDINFOEX サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fMask : DWORD (+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,上位
; lpVerb : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpParameters : LPSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; lpDirectory : LPSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; nShow : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwHotKey : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; hIcon : HANDLE (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; lpTitle : LPSTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lpVerbW : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; lpParametersW : LPWSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; lpDirectoryW : LPWSTR (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; lpTitleW : LPWSTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ptInvoke : POINT (+96, 8byte) varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; ※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 CMINVOKECOMMANDINFOEX
#field int cbSize
#field int fMask
#field intptr hwnd
#field intptr lpVerb
#field intptr lpParameters
#field intptr lpDirectory
#field int nShow
#field int dwHotKey
#field intptr hIcon
#field intptr lpTitle
#field intptr lpVerbW
#field intptr lpParametersW
#field intptr lpDirectoryW
#field intptr lpTitleW
#field POINT ptInvoke
#endstruct
stdim st, CMINVOKECOMMANDINFOEX ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize