Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › DEV_BROADCAST_OEM

DEV_BROADCAST_OEM

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

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

フィールド

フィールドサイズx64x86説明
dbco_sizeDWORD4+0+0この構造体のサイズ(バイト数)である。
dbco_devicetypeDWORD4+4+4デバイスの種類を示す値である(OEM 定義デバイスでは DBT_DEVTYP_OEM)。
dbco_reservedDWORD4+8+8予約済みである。使用しない。
dbco_identifierDWORD4+12+12デバイスの OEM 固有の識別子である。
dbco_suppfuncDWORD4+16+16デバイスの OEM 固有のサポート機能値である。

各言語での定義

#include <windows.h>

// DEV_BROADCAST_OEM  (x64 20 / x86 20 バイト)
typedef struct DEV_BROADCAST_OEM {
    DWORD dbco_size;
    DWORD dbco_devicetype;
    DWORD dbco_reserved;
    DWORD dbco_identifier;
    DWORD dbco_suppfunc;
} DEV_BROADCAST_OEM;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEV_BROADCAST_OEM
{
    public uint dbco_size;
    public uint dbco_devicetype;
    public uint dbco_reserved;
    public uint dbco_identifier;
    public uint dbco_suppfunc;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEV_BROADCAST_OEM
    Public dbco_size As UInteger
    Public dbco_devicetype As UInteger
    Public dbco_reserved As UInteger
    Public dbco_identifier As UInteger
    Public dbco_suppfunc As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DEV_BROADCAST_OEM(ctypes.Structure):
    _fields_ = [
        ("dbco_size", wintypes.DWORD),
        ("dbco_devicetype", wintypes.DWORD),
        ("dbco_reserved", wintypes.DWORD),
        ("dbco_identifier", wintypes.DWORD),
        ("dbco_suppfunc", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DEV_BROADCAST_OEM {
    pub dbco_size: u32,
    pub dbco_devicetype: u32,
    pub dbco_reserved: u32,
    pub dbco_identifier: u32,
    pub dbco_suppfunc: u32,
}
import "golang.org/x/sys/windows"

type DEV_BROADCAST_OEM struct {
	dbco_size uint32
	dbco_devicetype uint32
	dbco_reserved uint32
	dbco_identifier uint32
	dbco_suppfunc uint32
}
type
  DEV_BROADCAST_OEM = record
    dbco_size: DWORD;
    dbco_devicetype: DWORD;
    dbco_reserved: DWORD;
    dbco_identifier: DWORD;
    dbco_suppfunc: DWORD;
  end;
const DEV_BROADCAST_OEM = extern struct {
    dbco_size: u32,
    dbco_devicetype: u32,
    dbco_reserved: u32,
    dbco_identifier: u32,
    dbco_suppfunc: u32,
};
type
  DEV_BROADCAST_OEM {.bycopy.} = object
    dbco_size: uint32
    dbco_devicetype: uint32
    dbco_reserved: uint32
    dbco_identifier: uint32
    dbco_suppfunc: uint32
struct DEV_BROADCAST_OEM
{
    uint dbco_size;
    uint dbco_devicetype;
    uint dbco_reserved;
    uint dbco_identifier;
    uint dbco_suppfunc;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEV_BROADCAST_OEM サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dbco_size : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dbco_devicetype : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dbco_reserved : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dbco_identifier : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dbco_suppfunc : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEV_BROADCAST_OEM
    #field int dbco_size
    #field int dbco_devicetype
    #field int dbco_reserved
    #field int dbco_identifier
    #field int dbco_suppfunc
#endstruct

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