Registry Read and write

Discussion in 'MFC' started by newvcproj, Aug 1, 2008.

  1. newvcproj

    newvcproj New Member

    Joined:
    Jul 31, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Hi all

    I am new in vc++(MFC) and also for this forum.How can i read USB Device name which is connected in USB Port.I know it's information store in registry.But i am not able to do that.Sop plz give me example code..

    Plz help me


    Thx's in Advance..
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Search for USBTOR. As I am on Vista and reg is different I cannot tell you the exact location of it.
     
  3. newvcproj

    newvcproj New Member

    Joined:
    Jul 31, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    i am also on vista registry.Problem is not search USBSTOR.Problem is how i show USB device name..So plz if it is possible then give me some example code..

    Thx's for reply
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Check out the Friendly Name under some subkeys at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\
     
  5. newvcproj

    newvcproj New Member

    Joined:
    Jul 31, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    ok can you give some example code to show USB device Name which is currently attached..


    Thx's in advane
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I don't have the code But I guess if you have the Name in any key in registry you can get the String from it.
     
  7. newvcproj

    newvcproj New Member

    Joined:
    Jul 31, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0

    ok i have name of key
    Code:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR
    . Under this key i have found the name of device..

    Plz give me code becouse i have no idea about regedit code.Plz help me
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Then Search MSDN for RegOpenKey and related functions.
     
  9. newvcproj

    newvcproj New Member

    Joined:
    Jul 31, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0

    i have found a artical which is monitor a USB Drive and one option is there for disable.But problem is that when i chose the option of disable then it is Showing disable but when i attched again USB Drive then also showing disable.

    This is a link

    Code:

    http://www.codeproject.com/KB/system/HwDetect.aspx

    i want to set the option of Enable also.When i chose the option of enable then USB Drive Show me enable.And i have no idea about that so plz tell help me..
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice