PDA

Click to See Complete Forum and Search --> : Way to prevent Autorun?


zigona
Jun 6th, 2001, 01:10 PM
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:confused:

Xiquon
Jun 6th, 2001, 02:14 PM
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

zigona
Jun 7th, 2001, 12:50 AM
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

JoshT
Jun 7th, 2001, 05:56 AM
Holding the shift key down will temporarily disable AutoRun. I don't know if you could simulate that with code, though.

zigona
Jun 7th, 2001, 02:55 PM
:rolleyes: 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:confused:

bit6411
Jun 11th, 2001, 09:39 AM
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

bit6411
Jun 11th, 2001, 09:53 AM
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

zigona
Jun 12th, 2001, 02:02 AM
:) 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).