SHELLSTATEA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| _bitfield1 | INT | 4 | +0 | +0 | fShowAllObjects や fShowExtensions 等の表示オプション群を格納するビットフィールド。 |
| dwWin95Unused | DWORD | 4 | +4 | +4 | Windows 95 時代の未使用フィールド。 |
| uWin95Unused | DWORD | 4 | +8 | +8 | Windows 95 時代の未使用フィールド。 |
| lParamSort | INT | 4 | +12 | +12 | 現在のソート対象列を示す値。 |
| iSortDirection | INT | 4 | +16 | +16 | ソート方向を示す値。正で昇順、負で降順。 |
| version | DWORD | 4 | +20 | +20 | シェル状態構造体のバージョン番号。 |
| uNotUsed | DWORD | 4 | +24 | +24 | 未使用の予約フィールド。 |
| _bitfield2 | INT | 4 | +28 | +28 | fSepProcess や fStartPanelOn 等の追加表示オプションを格納するビットフィールド。 |
各言語での定義
#include <windows.h>
// SHELLSTATEA (x64 32 / x86 32 バイト)
#pragma pack(push, 1)
typedef struct SHELLSTATEA {
INT _bitfield1;
DWORD dwWin95Unused;
DWORD uWin95Unused;
INT lParamSort;
INT iSortDirection;
DWORD version;
DWORD uNotUsed;
INT _bitfield2;
} SHELLSTATEA;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SHELLSTATEA
{
public int _bitfield1;
public uint dwWin95Unused;
public uint uWin95Unused;
public int lParamSort;
public int iSortDirection;
public uint version;
public uint uNotUsed;
public int _bitfield2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SHELLSTATEA
Public _bitfield1 As Integer
Public dwWin95Unused As UInteger
Public uWin95Unused As UInteger
Public lParamSort As Integer
Public iSortDirection As Integer
Public version As UInteger
Public uNotUsed As UInteger
Public _bitfield2 As Integer
End Structureimport ctypes
from ctypes import wintypes
class SHELLSTATEA(ctypes.Structure):
_pack_ = 1
_fields_ = [
("_bitfield1", ctypes.c_int),
("dwWin95Unused", wintypes.DWORD),
("uWin95Unused", wintypes.DWORD),
("lParamSort", ctypes.c_int),
("iSortDirection", ctypes.c_int),
("version", wintypes.DWORD),
("uNotUsed", wintypes.DWORD),
("_bitfield2", ctypes.c_int),
]#[repr(C, packed(1))]
pub struct SHELLSTATEA {
pub _bitfield1: i32,
pub dwWin95Unused: u32,
pub uWin95Unused: u32,
pub lParamSort: i32,
pub iSortDirection: i32,
pub version: u32,
pub uNotUsed: u32,
pub _bitfield2: i32,
}import "golang.org/x/sys/windows"
type SHELLSTATEA struct {
_bitfield1 int32
dwWin95Unused uint32
uWin95Unused uint32
lParamSort int32
iSortDirection int32
version uint32
uNotUsed uint32
_bitfield2 int32
}type
SHELLSTATEA = packed record
_bitfield1: Integer;
dwWin95Unused: DWORD;
uWin95Unused: DWORD;
lParamSort: Integer;
iSortDirection: Integer;
version: DWORD;
uNotUsed: DWORD;
_bitfield2: Integer;
end;const SHELLSTATEA = extern struct {
_bitfield1: i32,
dwWin95Unused: u32,
uWin95Unused: u32,
lParamSort: i32,
iSortDirection: i32,
version: u32,
uNotUsed: u32,
_bitfield2: i32,
};type
SHELLSTATEA {.packed.} = object
_bitfield1: int32
dwWin95Unused: uint32
uWin95Unused: uint32
lParamSort: int32
iSortDirection: int32
version: uint32
uNotUsed: uint32
_bitfield2: int32align(1)
struct SHELLSTATEA
{
int _bitfield1;
uint dwWin95Unused;
uint uWin95Unused;
int lParamSort;
int iSortDirection;
uint version;
uint uNotUsed;
int _bitfield2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SHELLSTATEA サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; _bitfield1 : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwWin95Unused : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; uWin95Unused : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lParamSort : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; iSortDirection : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; version : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; uNotUsed : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; _bitfield2 : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SHELLSTATEA, pack=1
#field int _bitfield1
#field int dwWin95Unused
#field int uWin95Unused
#field int lParamSort
#field int iSortDirection
#field int version
#field int uNotUsed
#field int _bitfield2
#endstruct
stdim st, SHELLSTATEA ; NSTRUCT 変数を確保
st->_bitfield1 = 100
mes "_bitfield1=" + st->_bitfield1