Results 1 to 2 of 2

Thread: detecting usb token in vb

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    3

    detecting usb token in vb

    hi

    is it possible for me to develop an application which can autodetect whenever a usb token is inserted into the usb slot, then launchs a program automatically?

    I have the usb token's sdk..but i'm not sure how to do this..by the way the token is using cryptoki dll (if this information may help).

  2. #2
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    Re: detecting usb token in vb

    Mmh no one replied to this one yet? Tss...

    Well hardware detection requires use of the WMI interface (Hope you got your SQL skills up as the WMI is basically a sorta query DB ). Scan the WMI for the USB name. Basically if you find it it's connected.

    Some more info on WMI -> http://msdn.microsoft.com/library/de..._reference.asp

    Edit: I'll make it a lot easier for ya now:
    An example of how to query network adapters..
    VB Code:
    1. strComputer = "."
    2. Set objWMIService = _
    3.     GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    4. Set colNetCards = objWMIService.ExecQuery _
    5.     ("Select * From Win32_NetworkAdapterConfiguration " _
    6.     & "Where IPEnabled = True")
    7. For Each objNetCard in colNetCards
    8.     errResult = objNetCard.SetTCPIPNetBIOS(1)
    9.          If errResult Then
    10.              WScript.Echo  "Error number: " & Err.Number & _  
    11.                         vbNewLine & _
    12.                        "Description: " & Err.Description
    13.          Else                  
    14.              WScript.Echo "NetBIOS enabled over TCPIP"
    15.          End If    
    16. Next

    G'luck
    Last edited by Devion; Aug 19th, 2005 at 02:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width