Solved

CD-ROM to know where flash file is

Posted on 2002-03-24
9
196 Views
Last Modified: 2010-04-05
Hello -

I have a Delphi 6 app where I have added Flash's OCX to it. There is a property that askes for a Moive URL - pointing to the file. If I pre-qualify the path, like e:\demo\intro.sfw, the file loads just fine when my app runs. But since the Delphi app will end up on on a CD-ROM, there is no way to hard code the path in, since I won't know the drive letter of the cd-rom for each system.

What's the best method to handle this? Here's the code I have now, but shellexecute opens it in a separte window instead of within the app:

procedure TForm1.Button2Click(Sender: TObject);
begin
temppath := 'E:\demo\intro.swf';
if(ShellExecute(HInstance, 'Open', temppath , '', '', SW_SHOWNORMAL)= ERROR_FILE_NOT_FOUND)
then
      begin
      MessageDlg('Unable to file: SWF.' + chr(13) +
      'Please launch it from the Disk Location.', mtWarning,[mbOk],0);
     end;
end;




Thanks

RB
0
Comment
Question by:routerboy309
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6892703
Hello

  Don't hard code the drive name, you can use  ExtractFileDir(Application.ExeName) to return the current path then add ur file path to it like:

ShowMessage(ExtractFileDir(Application.ExeName) + '\demo\intro.swf')

or you can check for the cd rom from the drives in ur pc like

procedure TForm1.Button1Click(Sender: TObject);
var
  x,
  DrvType   : Integer;
  DrvLetter,
  DrvString : String;
begin
  for x := Ord('A') to Ord('Z') do
  begin
    DrvLetter := Chr(x)+':\';
    DrvType := GetDriveType(pChar(DrvLetter));
    case DrvType of
      0,1               : DrvString := '';
      DRIVE_REMOVABLE      : DrvString := 'Removable';
      DRIVE_FIXED     : DrvString := 'Fixed';
      DRIVE_REMOTE     : DrvString := 'Network';
      DRIVE_CDROM     : DrvString := 'CD-ROM';
      DRIVE_RAMDISK     : DrvString := 'RAM disk';
    end;
    if DrvString <> '' then
      Listbox1.Items.Add(DrvLetter + ' = ' + DrvString);
  end;
end;

0
 

Author Comment

by:routerboy309
ID: 6893109
Using ExtractFileDir(Application.ExeName) + '\intro.swf'; did the trick!

Thanks -

RB

0
 
LVL 1

Accepted Solution

by:
Alone earned 0 total points
ID: 6901876
Use relational paths instead of absolute - you may not need to learn about the CD-ROM (or any other drive) letter
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:routerboy309
ID: 6902895
Thanks to all -

RB
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6906556
Hello routerboy309

  How did you accept Alone comment as answer?, I gave you the answer and it's worked with you?
0
 

Author Comment

by:routerboy309
ID: 6906821
Thats a good question. I must of clicked wrong. Let me send an email to EE and get that corrected.

Alone - can you understand my error?

I'll keep you posted.

RB
0
 
LVL 1

Expert Comment

by:Alone
ID: 6907692
OK
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6912702
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?qid=20283999  Points for mnasman awaiting comments to correct this.

Moondancer - EE Moderator
0
 

Author Comment

by:routerboy309
ID: 6914338
Thanks Moondancer.

RB
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 121
Tvertscrollbox like a whatsapp layout 5 69
Delphi TListView and TEdit (Select item and input into TEdit) 10 86
TlistView is Really heavy on Android 3 44
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

752 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