Autorun in Delphi

I recently created autorun application in Delphi, but I have a big problem.
Problem is that autorun (Windows 98) don't want to load any of its files when the autorun.exe is runned through Cd-Rom shortcut (in My Computer)

Also Why It don't work under Windows XP.
(or why any Delphi application which consists loading files from computer don't work under Windows XP)

Hint: I use Delphi 5.0, and aldready tried GetDir, ChDir procedures which don't produced any effect

Comments

  • : I recently created autorun application in Delphi, but I have a big problem.
    : Problem is that autorun (Windows 98) don't want to load any of its files when the autorun.exe is runned through Cd-Rom shortcut (in My Computer)
    :
    : Also Why It don't work under Windows XP.
    : (or why any Delphi application which consists loading files from computer don't work under Windows XP)
    :
    : Hint: I use Delphi 5.0, and aldready tried GetDir, ChDir procedures which don't produced any effect
    :
    This sounds like a case of the wrong directories, because I (Delphi 5 user) have never had such experiences. In case of the autorun, you can get the letter of the CD-Rom drive by expanding the application path and looking at the first letter:
    [code]
    CDRomDrive := ExpandFileName(ParamStr(0))[1];
    [/code]
    You obviously know the paths of the data files, which means that you can easily include their entire path when loading them:
    [code]
    Memo1.Lines.LoadFromFile(CDRomDrive+': extsometext.txt');
    [/code]
    If you are placing data files on the computer, just add an additional global path variable to your program. This value can be stored in either a config file or the registry. This way you can always provide the right path with your data files.
  • Thanks anyway, but it looks like that this problem appears on different versions of Windows 98. I don't know how but after running my old piece of code through shortcut, everything loaded normal (!?!) To ensure safety of my autorun I added your piece of code too, and now both versions (older and new) run correctly on Windows98.

    However program still don't work under WINXP. Is there something about XP that I must be aware when I load files (no matter from HDD or CD)
  • : Thanks anyway, but it looks like that this problem appears on different versions of Windows 98. I don't know how but after running my old piece of code through shortcut, everything loaded normal (!?!) To ensure safety of my autorun I added your piece of code too, and now both versions (older and new) run correctly on Windows98.
    :
    : However program still don't work under WINXP. Is there something about XP that I must be aware when I load files (no matter from HDD or CD)
    :
    I don't know if your program needs special privileges under XP to use ChDir(), because I never use those functions. I have had some bad experiences with them, so nowadays I always supply the whole path to the datafile, which the program determines based on the installation path of the program itself. If the user is asked for a path I always use the standard TOpenDialog. This also includes the path. If in doubt I use the ExpandFileame() function.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories