473,320 Members | 1,828 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,320 software developers and data experts.

getting USB connection

hi, iim trying to write a driver for an mp3 player i have. ive been looking
on google for hours, but nothing i try works...i was wondering if anyone
could point me in the right ditrection on why my code wont work...thanks

Private wmiEventHandler As New Management.EventArrivedEventHandler(AddressOf
UsbEventArrived)
Private WithEvents wmiEventWatcher As Management.ManagementEventWatcher
Private WithEvents wmiOperationObser As New
Management.ManagementOperationObserver
Private wmiEventQuery As New Management.WqlEventQuery
Public Sub GetWmi()

Dim scope As New Management.ManagementScope("root\CIMV2")

scope.Options.EnablePrivileges = True

Try

wmiEventQuery.EventClassName = "__InstanceCreationEvent"
wmiEventQuery.WithinInterval = New TimeSpan(0, 0, 10)
wmiEventQuery.Condition = "TargetInstance ISA
'Win32_USBControllerDevice' "

wmiEventWatcher = New Management.ManagementEventWatcher(scope,
wmiEventQuery)

wmiEventWatcher.Start()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

Public Sub UsbEventArrived(ByVal sender As Object, ByVal e As
Management.EventArrivedEventArgs) Handles wmiEventWatcher.EventArrived

''Get the Event object and display it
For Each pd As Management.PropertyData In e.NewEvent.Properties

''ExtendedObject is a temp name, its a class inherited from TreeNode.
''only adds new string properties
Dim obj As New ExtendedObject

Dim mbo As Management.ManagementBaseObject = CType(pd.Value,
Management.ManagementBaseObject)

obj.Name = pd.Name
obj.Text = pd.Name
obj.Type = pd.Type.ToString()
obj.Value = pd.Value
obj.Origin = pd.Origin

''once this line is hit, the sub is exited
'Me.TreeView1.Nodes.Add(obj)

''second time through, once the code gets here, the sub is exited
If mbo IsNot Nothing Then

For Each prop As Management.PropertyData In mbo.Properties

Dim obj2 As New ExtendedObject

obj2.Name = prop.Name
obj2.Value = prop.Value

obj.Nodes.Add(obj2)

Next

End If

Next

End Sub

--
-iwdu15
Nov 15 '06 #1
0 807

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

Similar topics

3
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
4
by: Richard G | last post by:
I'm a database guy, so go easy on me here. :) How can I get the rowcount of the affected rows of a SQL statement from a stored procedure call? I know that "set nocount on" does not return the...
2
by: Martin Raychev | last post by:
Hi all, I have the following problem: I have a private method that returns a SqlDataReader. For this to work I have not to close the DB connection in the above method. I do this only to
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
9
by: =?Utf-8?B?UmF5?= | last post by:
Have SQL server on one machine. Have IIS on another machine in same large intranet. Have website in IIS with Basic Authentication turned on and other options deselected. Have webpage (.aspx) with...
2
by: ajos | last post by:
hi friends, im using tomcat 5.5.23 ,mysql 5.0 server,connector/J ,jdk1.5....can anybody plz tell me how to do connection pooling coz im really confused coz all im getting is scaterred...
2
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following...
0
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
9
by: KDawg44 | last post by:
Hi, I have PHP function that adds a record to the database. The table has an ID that is AUTO_INCREMENT. Is there anyway to get that ID back when I do any kind of insert? That ID is a foreign...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.