Solved

How can I Check my application Is running from CD

Posted on 2004-04-04
3
224 Views
Last Modified: 2010-04-05
I Want to enforce my app. to absolutely run from CD. How can I do that?
0
Comment
Question by:khalil_moghaddam
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 50 total points
ID: 10751373
What about this?

procedure TForm1.FormActivate(Sender: TObject);
begin
  if GetDriveType(PChar(ExtractFileDrive(Paramstr(0)))) <> DRIVE_CDROM then
    Close;
end;
0
 
LVL 17

Expert Comment

by:mokule
ID: 10751393
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.
0
 
LVL 1

Author Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now