如何在闪存盘上实现类似CD-ROM的自动播放效果(100分)

  • 主题发起人 主题发起人 zleo
  • 开始时间 开始时间
Z

zleo

Unregistered / Unconfirmed
GUEST, unregistred user!
就是闪存盘一插上就运行指定的程序,用CD-ROM的AUTORUN.INF文件方法无效
 
有些闪存盘是可以自动运行的,你可以看看里面有什么类型的文件。[:)]
 
to:飘摇客
能告诉我是什么牌子的吗?我试了华旗,七喜,同方,朗科的,好象都不行,
只有华旗的移动硬盘在2000下可以用inf文件自动运行
在线等待,急...
 
好像改一下注册变就可以了,还是看看MSDN吧:
How to Test Autorun.inf Files
Last reviewed: July 30, 1997
Article ID: Q136214
4.00 WINDOWS kbmm

The information in this article applies to:
Microsoft Win32 Software Development Kit (SDK) version 4.0

SUMMARY
AutoPlay is enabled by the new 32-bit, protected-mode driver architecture in Windows 95.
Because the operating system can now detect the insertion of media in a CD-ROM drive,
it has the opportunity to do some intelligent processing whenever this occurs.

By default, Windows 95 only checks for an Autorun.inf file
when a CD-ROM disc is inserted into the CD-ROM drive. However,
you may want to test for syntax and logic errors before burning a CD-ROM disc.
This article explains how.

MORE INFORMATION
In Windows 95, whenever a CD-ROM disc is inserted,
the shell immediately checks to see if the CD-ROM disc has a PC filesystem.
If it does, Windows 95 looks for a file named Autorun.inf. If the file exists,
Windows 95 follows the instructions contained in the file,
which usually involves running a setup application of some sort.

However, by changing a setting in the Windows 95 registry,
you can have the Shell use AutoPlay on any media,
including shared network drives and floppy disks.

The registry key that needs to be modified is:

HKEY_CURRENT_USER/

Software/
Microsoft/
Windows/
CurrentVersion/
Policies/
Explorer/
"NoDriveTypeAutoRun"


This key, which is of type REG_BINARY, consists of four bytes.
The first byte is a bitmask defining which drive types should be AutoRun.
The other three bytes should be set to zero (0).
The bits in the bitmask correspond to these constants:


Type Bit

DRIVE_UNKNOWN 0
DRIVE_NO_ROOT_DIR 1
DRIVE_REMOVABLE 2
DRIVE_FIXED 3
DRIVE_REMOTE 4
DRIVE_CDROM 5
DRIVE_RAMDISK 6


Setting a bit in the bitmask prevents you from using AutoPlay with the corresponding drive type.
By default, the value in the registry is 0x95. Bits 0, 2, 4 and 7 are therefore set,
which means that drive types DRIVE_UNKNOWN, DRIVE_REMOVEABLE,
and DRIVE_REMOTE don't use AutoPlay information.(Bit 7 is set to cover future device types.)
Altering this registry value thus allows you to test Autorun.inf files
from a floppy disk (DRIVE_REMOVEABLE), network drive (DRIVE_REMOTE), and so on.
For example, to be able to test AutoPlay from a floppy disk,
set the value of the first byte to 0x91 to enable AutoPlay for floppy disks.
NOTE:
Most floppy disk drive controllers do not currently recognize when a floppy disk has been inserted.
To test AutoPlay on a floppy disk, first alter the registry setting so that bit DRIVE_REMOVEABLE is not set,
start the Windows Explorer, insert the floppy disk, and press the F5 key to refresh the display.

To test the Autorun.inf file on a given disk, using the right mouse button,
click the icon for the drive in the Windows Explorer.
The effects of the Autorun.inf file should be visible in the context menu.
--------------------------------------------------------------------------------
Additional reference words: 4.00
KBCategory: kbmm
KBSubcategory: MMCDROM
 
to 独帅,
我把"NoDriveTypeAutoRun"改成0x91了,在98下重启后闪存盘图标能变成自定义的图标,
但还是要双击图标才能运行,2000下好象没效果.
有没有什么方法在计算机默任设置下有类似cd-rom的autorun效果
 
我认为既然闪存盘图标能变成自定义的图标,那说明上面一段文字说的还是正确的,
不过我没用过闪存盘,所以不清楚到底是什么原因。可能就像上面所说的,
NOTE:
Most floppy disk drive controllers do not currently recognize when a floppy disk has been inserted.
或许也不是所有的闪存盘都支持这个功能吧。
 
把"NoDriveTypeAutoRun"改成0x91后,还要加入AUTORUN.INF阿!

 
to: wql
AUTORUN.INF是加了的,要不也不会变成自定义的图标了

我现在打算用一个后台程序监视一旦有闪存盘插上就运行制定的软件
但这种方法太别扭
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
后退
顶部