Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autorun CD 1

Status
Not open for further replies.

Zeroanarchy

Technical User
Jun 11, 2001
630
AU
looking for a method of automaticly running an exe file as soon as the cd is placed in the cd player.
 
Don't use VB to do that (it will never work).
On you can download an executable that does the work (combined with and autorun.ini file.
It will only work on window machines that allows CD autorun (registy setting)
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
yes of course you can use vb to do that! i've made one myself just over this weekend.

in the root directory of the cd you need a file called autorun.ini, create one yourself or copy one from an existing autorunning cd to see how its done

open the file and edit it to point to the name of you .exe file, any .exe file you make in vb will work with this, if you email reddragon105@hotmail.com i can send you my example file, its really simple
 
Yes that's right reddragon. That has nothing to do with VB and it will only work when opening an .exe file. If you want to open a document e.g. an .htm file you have to use an autorun program like I described and it can't be written in VB as there is no guarentee that the pc has the vb runtime library installed.
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
sunaj, thanks very much for your info, have not had a chance to try it on a cd. I did have the chance to run it by itself not bad. Might also see how reddragon105's idea goes as well.
reddragon105 thankyou for a diffrent aproach to solving my problem, looks like it may be of some use.

Thanks again both of you, much appreaciated

zero :)
 
As sunaj says, the problem with reddragon's solution is that it requires all the necessary support files to be installed and registered on the PC that you are trying to run the CD on.

What tends to happen (and I've certainly been guilty of this) is that you sometimes forget, as a VB developer, that other people's machines are not configured the same way as yours. Sure, it is easy to think about it when considering creating a setup program, but more subtle areas such as autorunning CDs are easier to forget...
 
strongm thanks very much for your advice, did not consider that, much appreciated.

Thanks everyone.

zero
 
strongm has a good point, the app i made was a cd with music videos on, you put the cd in and it auto runs, bringing up a form with a media player screen on it and a button to play each video directly, but i made it for my girlfriend and her computer is very bog standard (a 486 running windows 95) and i found the media player part would not work without the files MCI32.OCX and MSVBVM60.DLL

however, i tried and tested the autorun part on many different computers, including hers and it never needed any other files to run - its the application itself that needs extra files, autorun is the simplest thing possible
i assume you have made an app in vb and have compiled it into a *.exe file, and you want to put this onto a cd and make it run automatically when the cd is inserted? what you do is open a new text document and type in:

[autorun]
open=Fuel.exe

(where Fuel.exe was the name of the file, just change it to the name of yours) save the text document as autorun.ini and put it in the root directory of the cd when you burn it, along with the .exe file, if you put the exe file in a directory type:

[autorun]
open=Folder/Fuel.exe

another neat trick is when you make an icon for your app, download some icon drawing software, draw one and set it as the icon on the form that loads up when your app is run. when you compile the app that icon is made into the .exe files icon (mebbe you already knew that) to give the cd that icon (or even a different one) put this line into your autorun file:

icon=Fuel.ico

i know its not what you asked for, but it makes your apps look that bit more professional
 
It agree with strongm - I've had the same problems of the target machines not having the support files - and my exe's were VERY simple - just calling an install routine.

In the end I made a small program in C (Not so simple for a VB-head - infact an utter nightmare!) that autoruns index.htm in same folder as the .exe the users default browser using the API.

That way, what ever CD you burn, you just have to edit the index.htm to your liking, and you can pretty much guarantee it'll run on any machine.

There is a caveat - the target machine may not have a browser:-(. You can't guarantee it, and you should take every option into account - but lets face it, in this day and age, who hasn't? :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top