Results 1 to 8 of 8

Thread: Can someone please answer this question, I'm desperate!

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    London, United Kingdom
    Posts
    14

    Post

    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!

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    Use App.Path to get the path to your exe file.

    Good luck!

    ------------------
    Joacim Andersson
    [email protected]
    [email protected]
    www.YellowBlazer.com



  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    London, United Kingdom
    Posts
    14

    Post

    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!


  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Sacha
    Did you get this one sorted out in the end?


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

    [email protected]
    A BMW Group Company

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    London, United Kingdom
    Posts
    14

    Post

    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


  8. #8
    Junior Member
    Join Date
    Nov 1999
    Location
    Houston, TX - USA
    Posts
    21

    Post

    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
  •  



Click Here to Expand Forum to Full Width