Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › SENSORPROFILEID

SENSORPROFILEID

構造体
サイズx64: 24 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
TypeGUID16+0+0センサープロファイルの種別を識別するGUID。
IndexDWORD4+16+16同種プロファイル内のインデックス。
UnusedDWORD4+20+20未使用領域。0を設定する。

各言語での定義

#include <windows.h>

// SENSORPROFILEID  (x64 24 / x86 24 バイト)
typedef struct SENSORPROFILEID {
    GUID Type;
    DWORD Index;
    DWORD Unused;
} SENSORPROFILEID;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SENSORPROFILEID
{
    public Guid Type;
    public uint Index;
    public uint Unused;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SENSORPROFILEID
    Public Type As Guid
    Public Index As UInteger
    Public Unused As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SENSORPROFILEID(ctypes.Structure):
    _fields_ = [
        ("Type", GUID),
        ("Index", wintypes.DWORD),
        ("Unused", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SENSORPROFILEID {
    pub Type: GUID,
    pub Index: u32,
    pub Unused: u32,
}
import "golang.org/x/sys/windows"

type SENSORPROFILEID struct {
	Type windows.GUID
	Index uint32
	Unused uint32
}
type
  SENSORPROFILEID = record
    Type: TGUID;
    Index: DWORD;
    Unused: DWORD;
  end;
const SENSORPROFILEID = extern struct {
    Type: GUID,
    Index: u32,
    Unused: u32,
};
type
  SENSORPROFILEID {.bycopy.} = object
    Type: GUID
    Index: uint32
    Unused: uint32
struct SENSORPROFILEID
{
    GUID Type;
    uint Index;
    uint Unused;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SENSORPROFILEID サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Type : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; Index : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Unused : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global SENSORPROFILEID
    #field GUID Type
    #field int Index
    #field int Unused
#endstruct

stdim st, SENSORPROFILEID        ; NSTRUCT 変数を確保
st->Index = 100
mes "Index=" + st->Index