CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012
    Posts
    0

    Lightbulb C++ Programming - Eject USB Device

    Hello!
    I am programming in C++ for three years now, but I don't know Windows programming syntax.
    It is two day's now how I am trying to find most adjustable C++ code. I was even trying to wrote it myself by studying some codes that might worked some other people. I am using Bloodshed Dev C++ program and compiler and I don't know whether that is important.
    So I now that you can help me. So.. I need program that when I run it will just eject USB device that I just pluged in my computer. I don't need it for CD/DVD devices, I need it only for USB Removable Devices. And please I need it in C or C++ language. And is it possible to input name or letter of device and then eject it? Is it going to differend code if program will be for Windows XP and Windows Vista / 7?
    Thank you.

  2. #2
    Join Date
    Dec 2011
    Location
    Bucharest, Romania
    Posts
    29

    Re: C++ Programming - Eject USB Device

    for USB devices you may add a autorun inf file in root folder, and drop a line that says
    [AutoRun] ;section
    open=app ;yourprogram
    eof
    Then it shall start app

    =====================================================================
    Use it wisely and watch MTV
    Last edited by john wiley; February 6th, 2012 at 05:17 AM.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: C++ Programming - Eject USB Device

    Quote Originally Posted by john wiley View Post
    for USB devices you may add a autorun inf file in root folder, and drop a line that says
    [AutoRun] ;section
    open=app ;yourprogram
    eof
    Then it shall start app
    Well....
    But OP asked about
    Quote Originally Posted by thanatos10011 View Post
    I need program that when I run it will just eject USB device that I just pluged in my computer. I don't need it for CD/DVD devices,
    Don't you understand the difference between "start app" and "eject USB device"?
    Victor Nijegorodov

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: C++ Programming - Eject USB Device

    Last time I made something similar I found this article http://www.codeproject.com/Articles/...r-Safe-Removal to be very useful.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Tags for this Thread

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

Featured