Board index » cppbuilder » Application on HD, Help on CD?

Application on HD, Help on CD?

I need an answer, if you can Help me.

How can I call (and open) an Help (*.hpj) File in a CD-ROM if the
Application is installed on my HD?
In fact, the letter of CD-ROM (E:, F:, G: ...)can change if in a P.C.
are installed a slave HD or something else, how can I find (and call an
application)
the CD_ROM drive dynamically??

Thanks a lot to all.
Ronnie.

 

Re:Application on HD, Help on CD?


Quote
Zanini Ronnie <ron...@netics.com> wrote in message

news:3819A3B4.707A25D5@netics.com...

Quote
> How can I call (and open) an Help (*.hpj) File in a CD-ROM if the
> Application is installed on my HD?
> In fact, the letter of CD-ROM (E:, F:, G: ...)can change if in a P.C.
> are installed a slave HD or something else, how can I find (and call
> an application) the CD_ROM drive dynamically??

Try this.  It will search every drive letter until it finds a CD-ROM drive,
and then if found it will check that drive for the existance of the file you
want to run, and run it if found

#include <shellapi.h>

for(int i = 0; i < 26; ++i)
{
    AnsiString drive((char)(i + 97));
    drive = drive + ":\\";

    // The only line you should need to change is this one
    AnsiString filename = (drive+"myfile.hpj");

    if(GetDriveType(drive.c_str()) == DRIVE_CDROM)
    {
        if(FileExists(filename)
        {
            ShellExecute(Handle, "open", filename.c_str(), NULL, NULL,
SW_SHOWNORMAL);
        break;
        }
    }

Quote
}

Gambit

Other Threads