Solved

CD-ROM to know where flash file is

Posted on 2002-03-24
9
189 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
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 22

Expert Comment

by:mnasman
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
 

Author Comment

by:routerboy309
ID: 6902895
Thanks to all -

RB
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 22

Expert Comment

by:mnasman
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Deploying Delphi Application on Web Server 3 79
Delphi - replicating a form 8 57
Magic Software info 18 103
Delphi inherited method 6 40
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

14 Experts available now in Live!

Get 1:1 Help Now