Link to home
Start Free TrialLog in
Avatar of khalil_moghaddam
khalil_moghaddam

asked on

How can I Check my application Is running from CD

I Want to enforce my app. to absolutely run from CD. How can I do that?
ASKER CERTIFIED SOLUTION
Avatar of mokule
mokule
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or if You want to do it in an earlier application creation state.

program Project1;

uses
  Forms,Windows, Sysutils,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  if GetDriveType(PChar(ExtractFileDrive(Paramstr(0)))) <> DRIVE_CDROM then
    begin
    Application.MessageBox('You must run this program from CD','Error',MB_OK);
    end
  else
    Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
Avatar of khalil_moghaddam
khalil_moghaddam

ASKER

Thanks a lot, But I think it can't recognize Virtual CD drive. Is there any way to prohibit using virtual-cd drive?