Drive Recognition

I have a web browser program that I have put on a CD. I want to find a way when i open it it needs to open an html file i have specified on the CD with it. I have tried using a hidden text bar and have it open that file on load, Though the only problem is i can not figure out a way to make it work on every computer. For instance the file on my computer would be E:/HTML/file.html. Though on another computer it would be maybe D:/HTML/file.html because everyone's disk drives are different. Is there a function or some other way i can make this work? Please help
I believe you can use GetModuleFilename() (http://msdn.microsoft.com/en-us/library/ms683197%28VS.85%29.aspx) to determine the path your executable is running from. Extract the drive letter from there.

EDIT: Oops. Thought I was still in Windows Programming. I see this is General C++ Programming. Well, my solution would be one for Windows. Linux, Mac, etc. I don't know. :-(
Last edited on
the working directory will be the root (if that's where your html file is). So simply open HTML\\file.ext

<A HREF="HTML\\FILE.ext">Link</A>

<a href="HTML\\FILE.ext"> <img src="IMAGES\\IMG.ext"> </a>


If your autorun html file is not on the root, you can use ..\\ to go down a directory.
Last edited on
I am using Visual Basic, I dont even know if this is considered C++ programming =/ though Ultifinitus i tried that, It did not work
Well I hate to be a party pooper, but I know it does in fact work, I've done it myself mate.
Im using visual basic, And my code currently is
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Public Class Form1

    Private Sub Application_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate(TextBox1.Text) 
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate(TextBox1.Text)
    End Sub



    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class



In the Textbox's field "Text" i have set it to HTML\\htmlfile.html to be the default text, which means the page will load on that, I know this works because i tried it with google.com
Alright, if you're having troubles you could simply learn QT. =)

(edit) sorry for the kindatroll
Last edited on
Topic archived. No new replies allowed.