473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Retrieving dbcc_name string from a DEV_BROADCAST_DEVICEINTERFACE structure

I'm trying to get the Name of the USB device pluged in from the
RegisterDeviceNotification that I've used P/Invoke to marshal. I have
seen a similar posting on the VisualBasic newgroups but I do not know
how to translate the ReDim that occurs there into C#. Or wither this
will actually give me what I'm looking for.
The code I'm posting seems to work although I don't know how to
set the length of the name correctly in the Marshal.PtrToStructure()
call.

Thanks all for any help.
Hopefully this VB->VC translation can help someone out there as well

Jeff
Visual Basic Code:
==================
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.Text
Public Class Form1
Inherits System.Windows.Forms.Form

Public Class Win32
Public Const WM_DEVICECHANGE = &H219
Public Const DBT_DEVICEARRIVAL = &H8000
Public Const DBT_DEVICEREMOVECOMPLETE = &H8004
Public Const DEVICE_NOTIFY_WINDOW_HANDLE = 0
Public Const DEVICE_NOTIFY_SERVICE_HANDLE = 1
Public Const DBT_DEVTYP_DEVICEINTERFACE = 5
Public Shared GUID_IO_MEDIA_ARRIVAL As Guid = New
Guid("A5DCBF10-6530-11D2-901F-00C04FB951ED")

<StructLayout(LayoutKind.Sequential)> _
Public Class DEV_BROADCAST_DEVICEINTERFACE
Public dbcc_size As Integer
Public dbcc_devicetype As Integer
Public dbcc_reserved As Integer
Public dbcc_classguid As Guid
Public dbcc_name As Short
End Class
<StructLayout(LayoutKind.Sequential,
CharSet:=CharSet.Unicode)> _
Public Class DEV_BROADCAST_DEVICEINTERFACE1
Public dbcc_size As Integer
Public dbcc_devicetype As Integer
Public dbcc_reserved As Integer
<MarshalAs(UnmanagedType.ByValArray,
ArraySubType:=UnmanagedType.U1, SizeConst:=16)> _
Public dbcc_classguid() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=128)> _
Public dbcc_name() As Char
End Class
<StructLayout(LayoutKind.Sequential)> _
Public Class DEV_BROADCAST_HDR
Public dbcc_size As Integer
Public dbcc_devicetype As Integer
Public dbcc_reserved As Integer
End Class

<DllImport("user32.DLL", SetLastError:=True)> _
Public Shared Function _
RegisterDeviceNotification(ByVal IntPtr As IntPtr, ByVal
NotificationFilter As IntPtr, ByVal Flags As Int32) As IntPtr
End Function

<DllImport("kernel32.DLL")> _
Public Shared Function _
GetLastError() As Integer
End Function
End Class

Public Sub New()
MyBase.New()
InitializeComponent()
RegisterHidNotification()
End Sub

Public Sub RegisterHidNotification()
Dim dbi As Win32.DEV_BROADCAST_DEVICEINTERFACE = New
Win32.DEV_BROADCAST_DEVICEINTERFACE
Dim size As Integer
size = Marshal.SizeOf(dbi)
Dim gd As Guid
' MsgBox(Marshal.SizeOf(gd))
' MsgBox(Marshal.SizeOf(New
Win32.DEV_BROADCAST_DEVICEINTERFACE1))
dbi.dbcc_size = size
dbi.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE
dbi.dbcc_reserved = 0
dbi.dbcc_classguid = Win32.GUID_IO_MEDIA_ARRIVAL
Dim Buffer As IntPtr
Buffer = Marshal.AllocHGlobal(size)
Marshal.StructureToPtr(dbi, Buffer, True)
Dim r As IntPtr
r = Win32.RegisterDeviceNotification(Handle, Buffer,
Win32.DEVICE_NOTIFY_WINDOW_HANDLE)
Marshal.PtrToStructure(Buffer, dbi)
If r.ToInt32 = IntPtr.Zero.ToInt32 Then
MessageBox.Show(Win32.GetLastError().ToString())
End If
End Sub

Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = Win32.WM_DEVICECHANGE Then
OnDeviceChange(m)
End If
MyBase.WndProc(m)
End Sub

Private Sub OnDeviceChange(ByVal msg As Message)
Dim wParam As Integer
wParam = msg.WParam.ToInt32()
If wParam = Win32.DBT_DEVICEARRIVAL Then
Dim o As New Win32.DEV_BROADCAST_HDR
Dim b As New Win32.DEV_BROADCAST_DEVICEINTERFACE1
Dim gd As Guid
Marshal.PtrToStructure(msg.LParam, o)
If (o.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE)
Then
Dim strsize As Integer = (o.dbcc_size - 28) / 2
ReDim b.dbcc_name(strsize)
Marshal.PtrToStructure(msg.LParam, b)
MsgBox(New Guid(b.dbcc_classguid).ToString)
Dim str As New String(b.dbcc_name, 0, strsize)
MsgBox(str)
End If
MessageBox.Show("Arrival")
ElseIf wParam = Win32.DBT_DEVICEREMOVECOMPLETE Then
MessageBox.Show("Remove")
End If
End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
Me.Text = "Form1"
Dim t As New Guid("d07433c0-a98e-11d2-917a-00a0c9068ff3")
End Sub
End Class
Visual CSharp Equivilent
========================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
RegisterDeviceNotification();
}

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}

[STAThread] static void Main()
{
Application.Run(new Form1());
}

void RegisterDeviceNotification()
{
Win32.DEV_BROADCAST_DEVICEINTERFACE dbi = new
Win32.DEV_BROADCAST_DEVICEINTERFACE();
int size = Marshal.SizeOf(dbi);
dbi.dbcc_size = size;
dbi.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_reserved = 0;
dbi.dbcc_classguid = Win32.GUID_DEVINTERFACE_USB_DEVICE;
dbi.dbcc_name = 0;
IntPtr buffer = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(dbi, buffer, true);
IntPtr r = Win32.RegisterDeviceNotification(Handle, buffer,
Win32.DEVICE_NOTIFY_WINDOW_HANDLE);
if(r == IntPtr.Zero)
MessageBox.Show(Win32.GetLastError().ToString());
}
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case Win32.WM_DEVICECHANGE: OnDeviceChange(ref m); break;
}
base.WndProc (ref m);
}
void OnDeviceChange(ref Message msg)
{
int wParam = (int)msg.WParam;
if((wParam == Win32.DBT_DEVICEARRIVAL) || (wParam ==
Win32.DBT_DEVICEREMOVECOMPLETE))
{
// Read the dhdr.dbcc_devicetype - The Following code could also
be used
////////////////////////////////////////////////////////////////////////
//Win32.DEV_BROADCAST_HDR dhdr;
//dhdr = (Win32.DEV_BROADCAST_HDR)
Marshal.PtrToStructure(msg.LParam,typeof(Win32.DEV _BROADCAST_HDR));
//if (dhdr.dbcc_devicetype == Win32.DBT_DEVTYP_DEVICEINTERFACE)
int dbccSize = Marshal.ReadInt32(msg.LParam,0);
int devType = Marshal.ReadInt32(msg.LParam,4);

if(devType == Win32.DBT_DEVTYP_DEVICEINTERFACE)
{
Win32.DEV_BROADCAST_DEVICEINTERFACE1 dip;
dip = (Win32.DEV_BROADCAST_DEVICEINTERFACE1)
Marshal.PtrToStructure(msg.LParam,typeof(Win32.DEV _BROADCAST_DEVICEINTERFACE1));
string csTemp = new string(dip.dbcc_name);
MessageBox.Show(csTemp + " arrived/removed");
}
}
}
}
public class Win32
{
public const int WM_DEVICECHANGE = 0x0219;
public const int DBT_DEVICEARRIVAL = 0x8000, // system
detected a new device
DBT_DEVICEREMOVECOMPLETE = 0x8004; // device is gone
public const int DEVICE_NOTIFY_WINDOW_HANDLE = 0,
DEVICE_NOTIFY_SERVICE_HANDLE = 1;
public const int DBT_DEVTYP_DEVICEINTERFACE = 0x00000005; // device
interface class
public static Guid GUID_DEVINTERFACE_USB_DEVICE = new
Guid("A5DCBF10-6530-11D2-901F-00C04FB951ED");

[StructLayout(LayoutKind.Sequential)] public class DEV_BROADCAST_HDR
{
public int dbcc_size;
public int dbcc_devicetype;
public int dbcc_reserved;
}
[StructLayout(LayoutKind.Sequential)] public class
DEV_BROADCAST_DEVICEINTERFACE
{
public int dbcc_size;
public int dbcc_devicetype;
public int dbcc_reserved;
public Guid dbcc_classguid;
public short dbcc_name;
}

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public class DEV_BROADCAST_DEVICEINTERFACE1
{
public int dbcc_size;
public int dbcc_devicetype;
public int dbcc_reserved;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType=UnmanagedType.U1,
SizeConst=16)] public byte [] dbcc_classguid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=128)] public char []
dbcc_name;
}

[DllImport("user32.dll", SetLastError=true)] public static extern
IntPtr RegisterDeviceNotification( IntPtr hRecipient, IntPtr
NotificationFilter, Int32 Flags);
[DllImport("kernel32.dll")] public static extern int GetLastError();
}

}
Nov 16 '05 #1
1 11151
Not directly a code translation, but another way to achieve the same (or
better) result.
Using System.Management classes, you can install an event listener for USB
device controller events, these events are generated when USB devices are
connected. Note that every USB device consists of at least one or more
devices, for instance a USB disk generates 3 events when connected.

Following is a complete sample, just compile and try it out.

// This code demonstrates how to monitor the UsbControllerDevice for
// the arrival of pnp device creation/operation events
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Management;
class WMIEvent {
public static void Main() {
USBEvent usbEvnt = new USBEvent();
usbEvnt.Start();
Console.ReadLine(); // block main thread for test purposes
usbEvnt.Stop();
}
}

internal class USBEvent
{
ManagementEventWatcher w= null;

internal void Start()
{
// Bind to local machine
try {
WqlEventQuery q = new WqlEventQuery();
q.EventClassName = "__InstanceOperationEvent";
q.WithinInterval = new TimeSpan(0,0,3);
q.Condition = @"TargetInstance ISA 'Win32_USBControllerDevice' ";
w = new ManagementEventWatcher(q);
w.EventArrived += new EventArrivedEventHandler(this.UsbEventArrived);
w.Start(); // Start listen for events
}
catch(Exception e) {this.Stop();}
}
internal void Stop() {
w.EventArrived -= new EventArrivedEventHandler(this.UsbEventArrived);
w.Stop();
w.Dispose();
}
public void UsbEventArrived(object sender, EventArrivedEventArgs e) {
//Get the Event object and display all it properties
ManagementBaseObject mbo =
(ManagementBaseObject)e.NewEvent["TargetInstance"];
using(ManagementObject o = new
ManagementObject(mbo["Dependent"].ToString()))
{
o.Get();
if (o.Properties.Count == 0)
{
Console.WriteLine("No further device properties, device removed?");
}
foreach(PropertyData prop in o.Properties)
Console.WriteLine("{0} - {1}", prop.Name, prop.Value);
Console.WriteLine("-------------------------------");
}
}
}

Willy.

"Jeffrey B. Holtz" <jh****@accuratetechnologies.com> wrote in message
news:93**************************@posting.google.c om...
I'm trying to get the Name of the USB device pluged in from the
RegisterDeviceNotification that I've used P/Invoke to marshal. I have
seen a similar posting on the VisualBasic newgroups but I do not know
how to translate the ReDim that occurs there into C#. Or wither this
will actually give me what I'm looking for.
The code I'm posting seems to work although I don't know how to
set the length of the name correctly in the Marshal.PtrToStructure()
call.

Thanks all for any help.
Hopefully this VB->VC translation can help someone out there as well

Jeff
Visual Basic Code:
==================
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.Text
Public Class Form1
Inherits System.Windows.Forms.Form

Public Class Win32
Public Const WM_DEVICECHANGE = &H219
Public Const DBT_DEVICEARRIVAL = &H8000
Public Const DBT_DEVICEREMOVECOMPLETE = &H8004
Public Const DEVICE_NOTIFY_WINDOW_HANDLE = 0
Public Const DEVICE_NOTIFY_SERVICE_HANDLE = 1
Public Const DBT_DEVTYP_DEVICEINTERFACE = 5
Public Shared GUID_IO_MEDIA_ARRIVAL As Guid = New
Guid("A5DCBF10-6530-11D2-901F-00C04FB951ED")

<StructLayout(LayoutKind.Sequential)> _
Public Class DEV_BROADCAST_DEVICEINTERFACE
Public dbcc_size As Integer
Public dbcc_devicetype As Integer
Public dbcc_reserved As Integer
Public dbcc_classguid As Guid
Public dbcc_name As Short
End Class
<StructLayout(LayoutKind.Sequential,
CharSet:=CharSet.Unicode)> _
Public Class DEV_BROADCAST_DEVICEINTERFACE1
Public dbcc_size As Integer
Public dbcc_devicetype As Integer
Public dbcc_reserved As Integer
<MarshalAs(UnmanagedType.ByValArray,
ArraySubType:=UnmanagedType.U1, SizeConst:=16)> _
Public dbcc_classguid() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=128)> _
Public dbcc_name() As Char
End Class
<StructLayout(LayoutKind.Sequential)> _
Public Class DEV_BROADCAST_HDR
Public dbcc_size As Integer
Public dbcc_devicetype As Integer
Public dbcc_reserved As Integer
End Class

<DllImport("user32.DLL", SetLastError:=True)> _
Public Shared Function _
RegisterDeviceNotification(ByVal IntPtr As IntPtr, ByVal
NotificationFilter As IntPtr, ByVal Flags As Int32) As IntPtr
End Function

<DllImport("kernel32.DLL")> _
Public Shared Function _
GetLastError() As Integer
End Function
End Class

Public Sub New()
MyBase.New()
InitializeComponent()
RegisterHidNotification()
End Sub

Public Sub RegisterHidNotification()
Dim dbi As Win32.DEV_BROADCAST_DEVICEINTERFACE = New
Win32.DEV_BROADCAST_DEVICEINTERFACE
Dim size As Integer
size = Marshal.SizeOf(dbi)
Dim gd As Guid
' MsgBox(Marshal.SizeOf(gd))
' MsgBox(Marshal.SizeOf(New
Win32.DEV_BROADCAST_DEVICEINTERFACE1))
dbi.dbcc_size = size
dbi.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE
dbi.dbcc_reserved = 0
dbi.dbcc_classguid = Win32.GUID_IO_MEDIA_ARRIVAL
Dim Buffer As IntPtr
Buffer = Marshal.AllocHGlobal(size)
Marshal.StructureToPtr(dbi, Buffer, True)
Dim r As IntPtr
r = Win32.RegisterDeviceNotification(Handle, Buffer,
Win32.DEVICE_NOTIFY_WINDOW_HANDLE)
Marshal.PtrToStructure(Buffer, dbi)
If r.ToInt32 = IntPtr.Zero.ToInt32 Then
MessageBox.Show(Win32.GetLastError().ToString())
End If
End Sub

Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = Win32.WM_DEVICECHANGE Then
OnDeviceChange(m)
End If
MyBase.WndProc(m)
End Sub

Private Sub OnDeviceChange(ByVal msg As Message)
Dim wParam As Integer
wParam = msg.WParam.ToInt32()
If wParam = Win32.DBT_DEVICEARRIVAL Then
Dim o As New Win32.DEV_BROADCAST_HDR
Dim b As New Win32.DEV_BROADCAST_DEVICEINTERFACE1
Dim gd As Guid
Marshal.PtrToStructure(msg.LParam, o)
If (o.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE)
Then
Dim strsize As Integer = (o.dbcc_size - 28) / 2
ReDim b.dbcc_name(strsize)
Marshal.PtrToStructure(msg.LParam, b)
MsgBox(New Guid(b.dbcc_classguid).ToString)
Dim str As New String(b.dbcc_name, 0, strsize)
MsgBox(str)
End If
MessageBox.Show("Arrival")
ElseIf wParam = Win32.DBT_DEVICEREMOVECOMPLETE Then
MessageBox.Show("Remove")
End If
End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
Me.Text = "Form1"
Dim t As New Guid("d07433c0-a98e-11d2-917a-00a0c9068ff3")
End Sub
End Class
Visual CSharp Equivilent
========================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
RegisterDeviceNotification();
}

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}

[STAThread] static void Main()
{
Application.Run(new Form1());
}

void RegisterDeviceNotification()
{
Win32.DEV_BROADCAST_DEVICEINTERFACE dbi = new
Win32.DEV_BROADCAST_DEVICEINTERFACE();
int size = Marshal.SizeOf(dbi);
dbi.dbcc_size = size;
dbi.dbcc_devicetype = Win32.DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_reserved = 0;
dbi.dbcc_classguid = Win32.GUID_DEVINTERFACE_USB_DEVICE;
dbi.dbcc_name = 0;
IntPtr buffer = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(dbi, buffer, true);
IntPtr r = Win32.RegisterDeviceNotification(Handle, buffer,
Win32.DEVICE_NOTIFY_WINDOW_HANDLE);
if(r == IntPtr.Zero)
MessageBox.Show(Win32.GetLastError().ToString());
}
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case Win32.WM_DEVICECHANGE: OnDeviceChange(ref m); break;
}
base.WndProc (ref m);
}
void OnDeviceChange(ref Message msg)
{
int wParam = (int)msg.WParam;
if((wParam == Win32.DBT_DEVICEARRIVAL) || (wParam ==
Win32.DBT_DEVICEREMOVECOMPLETE))
{
// Read the dhdr.dbcc_devicetype - The Following code could also
be used
////////////////////////////////////////////////////////////////////////
//Win32.DEV_BROADCAST_HDR dhdr;
//dhdr = (Win32.DEV_BROADCAST_HDR)
Marshal.PtrToStructure(msg.LParam,typeof(Win32.DEV _BROADCAST_HDR));
//if (dhdr.dbcc_devicetype == Win32.DBT_DEVTYP_DEVICEINTERFACE)
int dbccSize = Marshal.ReadInt32(msg.LParam,0);
int devType = Marshal.ReadInt32(msg.LParam,4);

if(devType == Win32.DBT_DEVTYP_DEVICEINTERFACE)
{
Win32.DEV_BROADCAST_DEVICEINTERFACE1 dip;
dip = (Win32.DEV_BROADCAST_DEVICEINTERFACE1)
Marshal.PtrToStructure(msg.LParam,typeof(Win32.DEV _BROADCAST_DEVICEINTERFACE1));
string csTemp = new string(dip.dbcc_name);
MessageBox.Show(csTemp + " arrived/removed");
}
}
}
}
public class Win32
{
public const int WM_DEVICECHANGE = 0x0219;
public const int DBT_DEVICEARRIVAL = 0x8000, // system
detected a new device
DBT_DEVICEREMOVECOMPLETE = 0x8004; // device is gone
public const int DEVICE_NOTIFY_WINDOW_HANDLE = 0,
DEVICE_NOTIFY_SERVICE_HANDLE = 1;
public const int DBT_DEVTYP_DEVICEINTERFACE = 0x00000005; // device
interface class
public static Guid GUID_DEVINTERFACE_USB_DEVICE = new
Guid("A5DCBF10-6530-11D2-901F-00C04FB951ED");

[StructLayout(LayoutKind.Sequential)] public class DEV_BROADCAST_HDR
{
public int dbcc_size;
public int dbcc_devicetype;
public int dbcc_reserved;
}
[StructLayout(LayoutKind.Sequential)] public class
DEV_BROADCAST_DEVICEINTERFACE
{
public int dbcc_size;
public int dbcc_devicetype;
public int dbcc_reserved;
public Guid dbcc_classguid;
public short dbcc_name;
}

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public class DEV_BROADCAST_DEVICEINTERFACE1
{
public int dbcc_size;
public int dbcc_devicetype;
public int dbcc_reserved;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType=UnmanagedType.U1,
SizeConst=16)] public byte [] dbcc_classguid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=128)] public char []
dbcc_name;
}

[DllImport("user32.dll", SetLastError=true)] public static extern
IntPtr RegisterDeviceNotification( IntPtr hRecipient, IntPtr
NotificationFilter, Int32 Flags);
[DllImport("kernel32.dll")] public static extern int GetLastError();
}

}

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: BlackHawke | last post by:
Hello! In our game package (www.andromedaonline.net) we are having problems with sounds. We have placed them in a jar file, and are trying to access them from there. The jar file has a...
35
by: NickName | last post by:
I understand it's easy to list all saved queries of a given Access database via Msysobjects system table. However, I have not seen any posting over this NG or other similar ones that also include...
5
by: jan axelson | last post by:
My application is using RegisterDeviceNotification() to detect attachment and removal of a USB HID-class device. The form is receiving WM_DEVICECHANGE messages with wParam set to...
2
by: Jay Banks | last post by:
I'm working on a project that lists a few hundred items in a checked listbox. The listbox entries are all backed up by a structure, and only the descriptiong of the structure is shown in the...
0
by: AvecFromage | last post by:
Hi, I'd like to be able to read the positions of all the Icons on my WinXP desktop. I've had a look around to see how to do it and I've come up with the code below...but it doesn't work. :o( ...
8
by: Chad | last post by:
To anyone who is smarter than I am when it comes to WMI: Here is what I am trying to do: 1) Detect a USB pen drive when it is inserted 2) Retrieve the drive letter of the pen drive 3) Check...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
1
by: lmwasisebe | last post by:
hie guys i having problems retrieving xml values, this is the structure of the problem: I have a database with the following fields, 1)id 2)state 3)request. the request field contains a xml file...
3
by: =?Utf-8?B?UHJpeWE=?= | last post by:
Hi, Could someone tell me how to retrieve a drive's drive letter from user mode given its device name? Any information is greatly appreciated. Thanks, Priya
3
by: BlackShadow33p1 | last post by:
I'm trying to write a program in C++ that gets the handles of all the visible entries in the windows taskbar. The method I've used so far is to send the TB_GETBUTTON message to the taskbar. ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.