|
-
Nov 3rd, 1999, 10:12 PM
#1
Thread Starter
New Member
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!
-
Nov 3rd, 1999, 10:16 PM
#2
Frenzied Member
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
[email protected]
A BMW Group Company
-
Nov 3rd, 1999, 10:23 PM
#3
Use App.Path to get the path to your exe file.
Good luck!
------------------
Joacim Andersson
[email protected]
[email protected]
www.YellowBlazer.com
-
Nov 3rd, 1999, 10:34 PM
#4
Thread Starter
New Member
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!
-
Nov 3rd, 1999, 10:47 PM
#5
Frenzied Member
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
[email protected]
A BMW Group Company
-
Nov 7th, 1999, 04:43 PM
#6
Frenzied Member
Sacha
Did you get this one sorted out in the end?
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
Nov 7th, 1999, 05:48 PM
#7
Thread Starter
New Member
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
-
Nov 7th, 1999, 09:45 PM
#8
Junior Member
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, 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|