Results 1 to 8 of 8

Thread: Way to prevent Autorun?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Slovenia
    Posts
    11

    Exclamation Way to prevent Autorun?

    Hi there!
    I was wondering if there is a way to prevent that AutoRun feature on CD.
    What I'm trying to do, is to make an App for storing musical CD data (like CD library). The problem is, when I want to scan CD for Music titles, Authors and the name of the CD, the media player automaticly starts - I don't want that to happen!

    I'll appreciate ANY suggestion.

    Regards! Ales Zigon

  2. #2
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Here is the reg key

    Win2k
    0 to disable
    1 to enable
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Autorun

    Not sure where Microsoft hid this key in Win 98.

    Also attached a usefull .bas for registry manipulation.

    -Xiquon
    Attached Files Attached Files

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Slovenia
    Posts
    11

    Thumbs up

    Yes, I'm using ME but still... this shall help me. I guess there must be a similar name in my registry. BTW - thanx for BAS!

    Bless you!
    Regards! Ales Zigon

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Holding the shift key down will temporarily disable AutoRun. I don't know if you could simulate that with code, though.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Slovenia
    Posts
    11
    Yes, I know.Right now,I'm thinking about sending keys (like: SendKeys {"Shift"}, True - or something). The problem is, I don't know where to send it!

    Maybe, just maybe: When looking on the drive (CD), I would try to detect that Autorun.*. And if found just would try to ignore it. What do you think?

    Regards! Ales Zigon

  6. #6
    New Member
    Join Date
    Jun 2001
    Posts
    8
    zigona just use keyb_event. It simulates pressing a key.


    Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Private Sub Form_KeyPress(KeyAscii As Integer)
    Public Const KEYEVENTF_EXTENDEDKEY = &H1
    Public Const KEYEVENTF_KEYUP = &H2
    Public Const VK_SHIFT = &H10


    then for like form_load

    keybd_event VK_SHIFT, 0, 0, 0
    and when u want to release it
    keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0
    ooooooh squishy

  7. #7
    New Member
    Join Date
    Jun 2001
    Posts
    8
    Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Public Const KEYEVENTF_EXTENDEDKEY = &H1
    Public Const KEYEVENTF_KEYUP = &H2
    Public Const VK_SHIFT = &H10


    then for like form_load

    keybd_event VK_SHIFT, 0, 0, 0
    and when u want to release it
    keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0

    sorry there was not supposed to be a form1_Keypress statement
    ooooooh squishy

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Slovenia
    Posts
    11

    Smile

    THANK YOU,THANK YOU,THANK YOU!!

    BTW: Do you know, where can post (or upload) the project I've made (it's using some good code from this site).
    I don't want people to have the same problems I had and they can also learn something new (I know I did).

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