SHCOLUMNDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwFlags | DWORD | 4 | +0 | +0 | データ取得の挙動を制御するフラグ。 |
| dwFileAttributes | DWORD | 4 | +4 | +4 | 対象ファイルの属性(FILE_ATTRIBUTE_ 系)。 |
| dwReserved | DWORD | 4 | +8 | +8 | 予約領域。0を設定する。 |
| pwszExt | LPWSTR | 8/4 | +16 | +12 | ファイル拡張子へのポインタ(ドットを含む)。 |
| wszFile | WCHAR | 520 | +24 | +16 | 対象ファイルのフルパスを格納する WCHAR 配列。 |
各言語での定義
#include <windows.h>
// SHCOLUMNDATA (x64 544 / x86 536 バイト)
typedef struct SHCOLUMNDATA {
DWORD dwFlags;
DWORD dwFileAttributes;
DWORD dwReserved;
LPWSTR pwszExt;
WCHAR wszFile[260];
} SHCOLUMNDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHCOLUMNDATA
{
public uint dwFlags;
public uint dwFileAttributes;
public uint dwReserved;
public IntPtr pwszExt;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string wszFile;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SHCOLUMNDATA
Public dwFlags As UInteger
Public dwFileAttributes As UInteger
Public dwReserved As UInteger
Public pwszExt As IntPtr
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public wszFile As String
End Structureimport ctypes
from ctypes import wintypes
class SHCOLUMNDATA(ctypes.Structure):
_fields_ = [
("dwFlags", wintypes.DWORD),
("dwFileAttributes", wintypes.DWORD),
("dwReserved", wintypes.DWORD),
("pwszExt", ctypes.c_void_p),
("wszFile", ctypes.c_wchar * 260),
]#[repr(C)]
pub struct SHCOLUMNDATA {
pub dwFlags: u32,
pub dwFileAttributes: u32,
pub dwReserved: u32,
pub pwszExt: *mut core::ffi::c_void,
pub wszFile: [u16; 260],
}import "golang.org/x/sys/windows"
type SHCOLUMNDATA struct {
dwFlags uint32
dwFileAttributes uint32
dwReserved uint32
pwszExt uintptr
wszFile [260]uint16
}type
SHCOLUMNDATA = record
dwFlags: DWORD;
dwFileAttributes: DWORD;
dwReserved: DWORD;
pwszExt: Pointer;
wszFile: array[0..259] of WideChar;
end;const SHCOLUMNDATA = extern struct {
dwFlags: u32,
dwFileAttributes: u32,
dwReserved: u32,
pwszExt: ?*anyopaque,
wszFile: [260]u16,
};type
SHCOLUMNDATA {.bycopy.} = object
dwFlags: uint32
dwFileAttributes: uint32
dwReserved: uint32
pwszExt: pointer
wszFile: array[260, uint16]struct SHCOLUMNDATA
{
uint dwFlags;
uint dwFileAttributes;
uint dwReserved;
void* pwszExt;
wchar[260] wszFile;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SHCOLUMNDATA サイズ: 536 バイト(x86)
dim st, 134 ; 4byte整数×134(構造体サイズ 536 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFileAttributes : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwReserved : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pwszExt : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; wszFile : WCHAR (+16, 520byte) varptr(st)+16 を基点に操作(520byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SHCOLUMNDATA サイズ: 544 バイト(x64)
dim st, 136 ; 4byte整数×136(構造体サイズ 544 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFileAttributes : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwReserved : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pwszExt : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; wszFile : WCHAR (+24, 520byte) varptr(st)+24 を基点に操作(520byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SHCOLUMNDATA
#field int dwFlags
#field int dwFileAttributes
#field int dwReserved
#field intptr pwszExt
#field wchar wszFile 260
#endstruct
stdim st, SHCOLUMNDATA ; NSTRUCT 変数を確保
st->dwFlags = 100
mes "dwFlags=" + st->dwFlags