ホーム › UI.WindowsAndMessaging › DEV_BROADCAST_NET
DEV_BROADCAST_NET
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dbcn_size | DWORD | 4 | +0 | +0 | この構造体のサイズ(バイト数)である。 |
| dbcn_devicetype | DWORD | 4 | +4 | +4 | デバイスの種類を示す値である(DBT_DEVTYP_NET)。 |
| dbcn_reserved | DWORD | 4 | +8 | +8 | 予約済みである。使用しない。 |
| dbcn_resource | DWORD | 4 | +12 | +12 | ネットワークリソースの識別子である。 |
| dbcn_flags | DWORD | 4 | +16 | +16 | ネットワークリソースに関するフラグである。 |
各言語での定義
#include <windows.h>
// DEV_BROADCAST_NET (x64 20 / x86 20 バイト)
typedef struct DEV_BROADCAST_NET {
DWORD dbcn_size;
DWORD dbcn_devicetype;
DWORD dbcn_reserved;
DWORD dbcn_resource;
DWORD dbcn_flags;
} DEV_BROADCAST_NET;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEV_BROADCAST_NET
{
public uint dbcn_size;
public uint dbcn_devicetype;
public uint dbcn_reserved;
public uint dbcn_resource;
public uint dbcn_flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEV_BROADCAST_NET
Public dbcn_size As UInteger
Public dbcn_devicetype As UInteger
Public dbcn_reserved As UInteger
Public dbcn_resource As UInteger
Public dbcn_flags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DEV_BROADCAST_NET(ctypes.Structure):
_fields_ = [
("dbcn_size", wintypes.DWORD),
("dbcn_devicetype", wintypes.DWORD),
("dbcn_reserved", wintypes.DWORD),
("dbcn_resource", wintypes.DWORD),
("dbcn_flags", wintypes.DWORD),
]#[repr(C)]
pub struct DEV_BROADCAST_NET {
pub dbcn_size: u32,
pub dbcn_devicetype: u32,
pub dbcn_reserved: u32,
pub dbcn_resource: u32,
pub dbcn_flags: u32,
}import "golang.org/x/sys/windows"
type DEV_BROADCAST_NET struct {
dbcn_size uint32
dbcn_devicetype uint32
dbcn_reserved uint32
dbcn_resource uint32
dbcn_flags uint32
}type
DEV_BROADCAST_NET = record
dbcn_size: DWORD;
dbcn_devicetype: DWORD;
dbcn_reserved: DWORD;
dbcn_resource: DWORD;
dbcn_flags: DWORD;
end;const DEV_BROADCAST_NET = extern struct {
dbcn_size: u32,
dbcn_devicetype: u32,
dbcn_reserved: u32,
dbcn_resource: u32,
dbcn_flags: u32,
};type
DEV_BROADCAST_NET {.bycopy.} = object
dbcn_size: uint32
dbcn_devicetype: uint32
dbcn_reserved: uint32
dbcn_resource: uint32
dbcn_flags: uint32struct DEV_BROADCAST_NET
{
uint dbcn_size;
uint dbcn_devicetype;
uint dbcn_reserved;
uint dbcn_resource;
uint dbcn_flags;
}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_NET サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dbcn_size : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dbcn_devicetype : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dbcn_reserved : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dbcn_resource : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dbcn_flags : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEV_BROADCAST_NET
#field int dbcn_size
#field int dbcn_devicetype
#field int dbcn_reserved
#field int dbcn_resource
#field int dbcn_flags
#endstruct
stdim st, DEV_BROADCAST_NET ; NSTRUCT 変数を確保
st->dbcn_size = 100
mes "dbcn_size=" + st->dbcn_size