Привожу ответ на подобный вопрос с сайта RusFaq.ru:
| Цитата | Список ответов на вопрос № 124135 / КОМПЬЮТЕРЫ И ПО / Языки программирования / Delphi
Вопрос Здравствуйте уважаемые эксперты. Вопрос: как сделать автозагрузку с флешки. Для CD/DVD создаётся файл Autorun.inf вида: [autorun] open=Prog.exe icon=ProgIcon.ico Для флэшки это почему-то не работает. Подскажите в чём дело. Отправил: Хукаленко Дмитрий (Посетитель) Дата отправки: 20.02.2008, 23:17 Поступило ответов: 1
Ответы Отвечает: Николай Владимирович / Н.В. Здравствуйте, Хукаленко Дмитрий! Если вообще не происходит автозагрузка флешки, проверьте, что включена служба Определение оборудования оболочки (Shell Hardware Detection).
С иконкой никаких абсолютно проблем быть не должно. С автозагрузкой сложнее. Автозапуск возможен только с несъемного устройства. Максимум что у меня получилось сделать - чтобы показывался диалог с выбором действия, в котором будет присутствовать пункт "autorun.exe". В приложении получившийся у меня autorun.inf.
Вот что пишет Microsoftпо поводу автозагрузки с флешки: Q: What must I do to trigger Autorun on my USB storage device? The Autorun capabilities are restricted to CD-ROM drives and fixed disk drives. If you need to make a USB storage device perform Autorun, the device must not be marked as a removable media device and the device must contain an Autorun.inf file and a startup application.
The removable media device setting is a flag contained within the SCSI Inquiry Data response to the SCSI Inquiry command. Bit 7 of byte 1 (indexed from 0) is the Removable Media Bit (RMB). A RMB set to zero indicates that the device is not a removable media device. A RMB of one indicates that the device is a removable media device. Drivers obtain this information by using the StorageDeviceProperty request.
For more information about the SCSI Inquiry command, see the T10 committee located at http://www.t10.org.
For more information about the StorageDeviceProperty, see the STORAGE_DEVICE_DESCRIPTOR storage structure in the Windows DDK, located at http://msdn2.microsoft.com/en-gb/library/aa510117.aspx.
For more information on Autorun.inf files see the "Creating an AutoRun-Enabled Application" article located at http://msdn2.microsoft.com/en-us/library/aa969330.aspx.
То есть придется еще помучиться, чтобы подменить тип устройства. Насколько это реально осуществить - не знаю, не пробовал.
Удачи!
Приложение: [autorun] shellexecute=autorun.exe open=autorun.exe action=autorun.exe shell\open\Command=autorun.exe shell\explore\Command=autorun.exe icon=install.ico
|
|