ホーム › UI.Controls › NMLVLINK
NMLVLINK
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hdr | NMHDR | 24/12 | +0 | +0 | 通知メッセージ共通ヘッダー。送信元情報と通知コードを保持する。 |
| link | LITEM | 4280 | +24 | +12 | クリックされたリンク項目の情報(LITEM)。 |
| iItem | INT | 4 | +4304 | +4292 | リンクを含む項目のインデックス。0始まり。 |
| iSubItem | INT | 4 | +4308 | +4296 | リンクを含むサブ項目のインデックス。0始まり。 |
各言語での定義
#include <windows.h>
// NMHDR (x64 24 / x86 12 バイト)
typedef struct NMHDR {
HWND hwndFrom;
UINT_PTR idFrom;
DWORD code;
} NMHDR;
// LITEM (x64 4280 / x86 4280 バイト)
typedef struct LITEM {
LIST_ITEM_FLAGS mask;
INT iLink;
LIST_ITEM_STATE_FLAGS state;
LIST_ITEM_STATE_FLAGS stateMask;
WCHAR szID[48];
WCHAR szUrl[2084];
} LITEM;
// NMLVLINK (x64 4312 / x86 4300 バイト)
typedef struct NMLVLINK {
NMHDR hdr;
LITEM link;
INT iItem;
INT iSubItem;
} NMLVLINK;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NMHDR
{
public IntPtr hwndFrom;
public UIntPtr idFrom;
public uint code;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LITEM
{
public uint mask;
public int iLink;
public uint state;
public uint stateMask;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)] public string szID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2084)] public string szUrl;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NMLVLINK
{
public NMHDR hdr;
public LITEM link;
public int iItem;
public int iSubItem;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NMHDR
Public hwndFrom As IntPtr
Public idFrom As UIntPtr
Public code As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LITEM
Public mask As UInteger
Public iLink As Integer
Public state As UInteger
Public stateMask As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=48)> Public szID As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=2084)> Public szUrl As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NMLVLINK
Public hdr As NMHDR
Public link As LITEM
Public iItem As Integer
Public iSubItem As Integer
End Structureimport ctypes
from ctypes import wintypes
class NMHDR(ctypes.Structure):
_fields_ = [
("hwndFrom", ctypes.c_void_p),
("idFrom", ctypes.c_size_t),
("code", wintypes.DWORD),
]
class LITEM(ctypes.Structure):
_fields_ = [
("mask", wintypes.DWORD),
("iLink", ctypes.c_int),
("state", wintypes.DWORD),
("stateMask", wintypes.DWORD),
("szID", ctypes.c_wchar * 48),
("szUrl", ctypes.c_wchar * 2084),
]
class NMLVLINK(ctypes.Structure):
_fields_ = [
("hdr", NMHDR),
("link", LITEM),
("iItem", ctypes.c_int),
("iSubItem", ctypes.c_int),
]#[repr(C)]
pub struct NMHDR {
pub hwndFrom: *mut core::ffi::c_void,
pub idFrom: usize,
pub code: u32,
}
#[repr(C)]
pub struct LITEM {
pub mask: u32,
pub iLink: i32,
pub state: u32,
pub stateMask: u32,
pub szID: [u16; 48],
pub szUrl: [u16; 2084],
}
#[repr(C)]
pub struct NMLVLINK {
pub hdr: NMHDR,
pub link: LITEM,
pub iItem: i32,
pub iSubItem: i32,
}import "golang.org/x/sys/windows"
type NMHDR struct {
hwndFrom uintptr
idFrom uintptr
code uint32
}
type LITEM struct {
mask uint32
iLink int32
state uint32
stateMask uint32
szID [48]uint16
szUrl [2084]uint16
}
type NMLVLINK struct {
hdr NMHDR
link LITEM
iItem int32
iSubItem int32
}type
NMHDR = record
hwndFrom: Pointer;
idFrom: NativeUInt;
code: DWORD;
end;
LITEM = record
mask: DWORD;
iLink: Integer;
state: DWORD;
stateMask: DWORD;
szID: array[0..47] of WideChar;
szUrl: array[0..2083] of WideChar;
end;
NMLVLINK = record
hdr: NMHDR;
link: LITEM;
iItem: Integer;
iSubItem: Integer;
end;const NMHDR = extern struct {
hwndFrom: ?*anyopaque,
idFrom: usize,
code: u32,
};
const LITEM = extern struct {
mask: u32,
iLink: i32,
state: u32,
stateMask: u32,
szID: [48]u16,
szUrl: [2084]u16,
};
const NMLVLINK = extern struct {
hdr: NMHDR,
link: LITEM,
iItem: i32,
iSubItem: i32,
};type
NMHDR {.bycopy.} = object
hwndFrom: pointer
idFrom: uint
code: uint32
LITEM {.bycopy.} = object
mask: uint32
iLink: int32
state: uint32
stateMask: uint32
szID: array[48, uint16]
szUrl: array[2084, uint16]
NMLVLINK {.bycopy.} = object
hdr: NMHDR
link: LITEM
iItem: int32
iSubItem: int32struct NMHDR
{
void* hwndFrom;
size_t idFrom;
uint code;
}
struct LITEM
{
uint mask;
int iLink;
uint state;
uint stateMask;
wchar[48] szID;
wchar[2084] szUrl;
}
struct NMLVLINK
{
NMHDR hdr;
LITEM link;
int iItem;
int iSubItem;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NMLVLINK サイズ: 4300 バイト(x86)
dim st, 1075 ; 4byte整数×1075(構造体サイズ 4300 / 4 切り上げ)
; hdr : NMHDR (+0, 12byte) varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; link : LITEM (+12, 4280byte) varptr(st)+12 を基点に操作(4280byte:入れ子/配列)
; iItem : INT (+4292, 4byte) st.1073 = 値 / 値 = st.1073 (lpoke/lpeek も可)
; iSubItem : INT (+4296, 4byte) st.1074 = 値 / 値 = st.1074 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NMLVLINK サイズ: 4312 バイト(x64)
dim st, 1078 ; 4byte整数×1078(構造体サイズ 4312 / 4 切り上げ)
; hdr : NMHDR (+0, 24byte) varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; link : LITEM (+24, 4280byte) varptr(st)+24 を基点に操作(4280byte:入れ子/配列)
; iItem : INT (+4304, 4byte) st.1076 = 値 / 値 = st.1076 (lpoke/lpeek も可)
; iSubItem : INT (+4308, 4byte) st.1077 = 値 / 値 = st.1077 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NMHDR
#field intptr hwndFrom
#field intptr idFrom
#field int code
#endstruct
#defstruct global LITEM
#field int mask
#field int iLink
#field int state
#field int stateMask
#field wchar szID 48
#field wchar szUrl 2084
#endstruct
#defstruct global NMLVLINK
#field NMHDR hdr
#field LITEM link
#field int iItem
#field int iSubItem
#endstruct
stdim st, NMLVLINK ; NSTRUCT 変数を確保
st->iItem = 100
mes "iItem=" + st->iItem