ホーム › NetworkManagement.WNet › NOTIFYADD
NOTIFYADD
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hwndOwner | HWND | 8/4 | +0 | +0 | 操作を開始したウィンドウのハンドル。 |
| NetResource | NETRESOURCEA | 48/32 | +8 | +4 | 追加(接続)対象のネットワークリソース情報(ANSI)。 |
| dwAddFlags | NET_CONNECT_FLAGS | 4 | +56 | +36 | 接続追加の動作を制御するフラグ(CONNECT_*)。 |
各言語での定義
#include <windows.h>
// NETRESOURCEA (x64 48 / x86 32 バイト)
typedef struct NETRESOURCEA {
NET_RESOURCE_SCOPE dwScope;
NET_RESOURCE_TYPE dwType;
DWORD dwDisplayType;
DWORD dwUsage;
LPSTR lpLocalName;
LPSTR lpRemoteName;
LPSTR lpComment;
LPSTR lpProvider;
} NETRESOURCEA;
// NOTIFYADD (x64 64 / x86 40 バイト)
typedef struct NOTIFYADD {
HWND hwndOwner;
NETRESOURCEA NetResource;
NET_CONNECT_FLAGS dwAddFlags;
} NOTIFYADD;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NETRESOURCEA
{
public uint dwScope;
public uint dwType;
public uint dwDisplayType;
public uint dwUsage;
public IntPtr lpLocalName;
public IntPtr lpRemoteName;
public IntPtr lpComment;
public IntPtr lpProvider;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NOTIFYADD
{
public IntPtr hwndOwner;
public NETRESOURCEA NetResource;
public uint dwAddFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NETRESOURCEA
Public dwScope As UInteger
Public dwType As UInteger
Public dwDisplayType As UInteger
Public dwUsage As UInteger
Public lpLocalName As IntPtr
Public lpRemoteName As IntPtr
Public lpComment As IntPtr
Public lpProvider As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NOTIFYADD
Public hwndOwner As IntPtr
Public NetResource As NETRESOURCEA
Public dwAddFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NETRESOURCEA(ctypes.Structure):
_fields_ = [
("dwScope", wintypes.DWORD),
("dwType", wintypes.DWORD),
("dwDisplayType", wintypes.DWORD),
("dwUsage", wintypes.DWORD),
("lpLocalName", ctypes.c_void_p),
("lpRemoteName", ctypes.c_void_p),
("lpComment", ctypes.c_void_p),
("lpProvider", ctypes.c_void_p),
]
class NOTIFYADD(ctypes.Structure):
_fields_ = [
("hwndOwner", ctypes.c_void_p),
("NetResource", NETRESOURCEA),
("dwAddFlags", wintypes.DWORD),
]#[repr(C)]
pub struct NETRESOURCEA {
pub dwScope: u32,
pub dwType: u32,
pub dwDisplayType: u32,
pub dwUsage: u32,
pub lpLocalName: *mut core::ffi::c_void,
pub lpRemoteName: *mut core::ffi::c_void,
pub lpComment: *mut core::ffi::c_void,
pub lpProvider: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct NOTIFYADD {
pub hwndOwner: *mut core::ffi::c_void,
pub NetResource: NETRESOURCEA,
pub dwAddFlags: u32,
}import "golang.org/x/sys/windows"
type NETRESOURCEA struct {
dwScope uint32
dwType uint32
dwDisplayType uint32
dwUsage uint32
lpLocalName uintptr
lpRemoteName uintptr
lpComment uintptr
lpProvider uintptr
}
type NOTIFYADD struct {
hwndOwner uintptr
NetResource NETRESOURCEA
dwAddFlags uint32
}type
NETRESOURCEA = record
dwScope: DWORD;
dwType: DWORD;
dwDisplayType: DWORD;
dwUsage: DWORD;
lpLocalName: Pointer;
lpRemoteName: Pointer;
lpComment: Pointer;
lpProvider: Pointer;
end;
NOTIFYADD = record
hwndOwner: Pointer;
NetResource: NETRESOURCEA;
dwAddFlags: DWORD;
end;const NETRESOURCEA = extern struct {
dwScope: u32,
dwType: u32,
dwDisplayType: u32,
dwUsage: u32,
lpLocalName: ?*anyopaque,
lpRemoteName: ?*anyopaque,
lpComment: ?*anyopaque,
lpProvider: ?*anyopaque,
};
const NOTIFYADD = extern struct {
hwndOwner: ?*anyopaque,
NetResource: NETRESOURCEA,
dwAddFlags: u32,
};type
NETRESOURCEA {.bycopy.} = object
dwScope: uint32
dwType: uint32
dwDisplayType: uint32
dwUsage: uint32
lpLocalName: pointer
lpRemoteName: pointer
lpComment: pointer
lpProvider: pointer
NOTIFYADD {.bycopy.} = object
hwndOwner: pointer
NetResource: NETRESOURCEA
dwAddFlags: uint32struct NETRESOURCEA
{
uint dwScope;
uint dwType;
uint dwDisplayType;
uint dwUsage;
void* lpLocalName;
void* lpRemoteName;
void* lpComment;
void* lpProvider;
}
struct NOTIFYADD
{
void* hwndOwner;
NETRESOURCEA NetResource;
uint dwAddFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NOTIFYADD サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; hwndOwner : HWND (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; NetResource : NETRESOURCEA (+4, 32byte) varptr(st)+4 を基点に操作(32byte:入れ子/配列)
; dwAddFlags : NET_CONNECT_FLAGS (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NOTIFYADD サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; hwndOwner : HWND (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; NetResource : NETRESOURCEA (+8, 48byte) varptr(st)+8 を基点に操作(48byte:入れ子/配列)
; dwAddFlags : NET_CONNECT_FLAGS (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NETRESOURCEA
#field int dwScope
#field int dwType
#field int dwDisplayType
#field int dwUsage
#field intptr lpLocalName
#field intptr lpRemoteName
#field intptr lpComment
#field intptr lpProvider
#endstruct
#defstruct global NOTIFYADD
#field intptr hwndOwner
#field NETRESOURCEA NetResource
#field int dwAddFlags
#endstruct
stdim st, NOTIFYADD ; NSTRUCT 変数を確保
st->dwAddFlags = 100
mes "dwAddFlags=" + st->dwAddFlags