PDA

Click to See Complete Forum and Search --> : Can someone please answer this question, I'm desperate!


Sacha Rowland
Nov 3rd, 1999, 09:12 PM
Could someone please tell me how I can get a vb program on a CD-ROM to call files on the CD-ROM without installing the program to the C Drive. I am at the stage where I can autorun the program, but when I ask the program to open a file on the CD-ROM it may not be successful as not everyone has their CD-ROM drive labelled as D Drive. How can it recognise the CD-ROM drive letter and then refer to files on it? I have been pulling my hair out on this one!

Mark Sreeves
Nov 3rd, 1999, 09:16 PM
If you want to access files on a cdrom from the cdrom itself why not just use .\ in the file path?

------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Joacim Andersson
Nov 3rd, 1999, 09:23 PM
Use App.Path to get the path to your exe file.

Good luck!

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

Sacha Rowland
Nov 3rd, 1999, 09:34 PM
Mark,

It's a little more complicated than that. I should have been more specific. I created an
internet browser in VB to open up an htm index which would go to whatever files are needed via hyperlinks. It's the browser's hyperlinks that won't work - using .\ in the hyperlinks won't point to the files. If I offer a path, however, it will find the file.

Maybe I should just give up using the browser and use buttons on a splash screen instead of browser hyperlinks. I thought using a browser would be easier!

Mark Sreeves
Nov 3rd, 1999, 09:47 PM
Oh! I see what you mean now!

You could use app.path to locate the drive letter and write a html file to th hard drive which points back to the initial html file on the cd rom

somthing like this might work....

<HEAD>
<HTML>


<SCRIPT LANGUAGE="JavaScript"><!--
if (document.images)
window.location.replace("file://......");
// the path here is derived from app.path

else
window.location.href = "file://......";
//--></SCRIPT>

</HEAD>
</HTML>


------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Mark Sreeves
Nov 7th, 1999, 03:43 PM
Sacha
Did you get this one sorted out in the end?


------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

Sacha Rowland
Nov 7th, 1999, 04:48 PM
Mark,

Thanks for your help. In the end I decided to ditch the browser and do it from a VB splash screen. I had trouble opening files so I asked the question: "I need to open a file from my .exe file but it is application specific and I would like my exe file to open the application first and then open the file within the application. (It's a .pdf graphics file that needs to be opened in Acrobat Reader.)
Can anyone help?"

I got this reply, which was very good and works well - even if I don't know how the hell it's working!!!

Sacha,
There are two methods you can use:

code:
--------------------------------------------------------------------------------

Private Sub Command1_Click() Shell Chr(34) & "C:\Program Files\Acroread\Acrord32.exe" & Chr(34) & " SomePDF.pdf", vbNormalFocusEnd sub

--------------------------------------------------------------------------------


Where Acrord32.exe is the Acrobat Reader EXE and SomePDF.pdf is the File and Path of the PDF you want to launch.
Or, more intuitively..


code:
--------------------------------------------------------------------------------

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPrivate Sub Command1_Click() ShellExecute 0&, "OPEN", "SomePDF.pdf", "", "", 1End Sub

--------------------------------------------------------------------------------


This method doesn't require you to know the location or name of the PDF Reader, as it launches the Associated EXE.

------------------
Aaron Young
Analyst Programmer

prestodsi
Nov 7th, 1999, 08:45 PM
Let me remind you, please, to be careful using the Acroreader in your applications.

Although I realize the Adobe's technology is fantastic, a very serious issue is that the reader cannot close files programatically, or even close pages.

Under those conditions, if the user browses too many pages, he will either run out of memory or slow down his program to an unbearable level.

I have discussed this extensively with Adobe and the fellows from www.PDFZone/com, (http://www.PDFZone/com,) then dumped by Acrobat 4.0 application and re-started with VB6.

If you wish call me at 281-4445988

regards


------------------
Paul Stermann
DSI-Houston