Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Open with help...


ghost's Avatar
0 0

Okay to put it simple I've made a text editor myself… it works but I want to know how I could have it as a default text editor….

When you open a file you can choose "Open With" then your program… for example if you chose Notepad then whatever you chose would be opened in Notepad… how would I get the to work with my text editor?

That was a strange way to describe things wasn't it…

Btw… I made it in VB.NET Download the old one here: http://darkpanther.freehostia.com/downloads/ That was the old Beta… it's been changed a lot since…


ghost's Avatar
0 0

Right click on the file and select properties, then where it says open with… click change then browse to your application. If you always want to use your app check the box to Always use the selected program to open this kind of file.


ghost's Avatar
0 0

Yeah, but when you open the file with the text editor it doesn't actually open the file if you know what I mean…. if you don't understand, dl the old version from the link I gave above and try it.

:matey:


richohealey's Avatar
Python Ninja
0 0

it'll be some C convention you haven't adhered to regarding the opening of files. google open conventions C or some shit like that, you'll find it eventually


ghost's Avatar
0 0

Umm… wha? :angry::o


Uber0n's Avatar
Member
0 0

When you open a file with a program, what it actually does is open the program with the file's name and path as the first argument. For example, if you open C:\test.txt with notepad.exe this is what will happen (seen as it works on the DOS prompt)

notepad.exe C:\test.txt

And the application notepad is written to open the first argument as a text file. Firefox is written to open the first argument as an URL, OllyDbg is written to debug the file in the first argument etc.

What you must do is to make the application check for arguments when you run it, and if there are any, make it load the first argument as a textfile.


ghost's Avatar
0 0

Okay, would you have any ideas about how to go about doing that? I'm using vb.net remember.


ghost's Avatar
0 0

Okay.. I'll check that when I'm back home (I don't have Visualstudio here), thanks.


Uber0n's Avatar
Member
0 0

No problem.

Good luck B)


ghost's Avatar
0 0

Thanks lol


ghost's Avatar
0 0

Okay… I think it should be something like this:

        If sArgs(0) = "" Then
            ' Do nothing
        Else
            Dim filecont As String
            Dim oFile As System.IO.File
            Dim oRead As System.IO.StreamReader
            oRead = oFile.OpenText(sArgs(0))
            filecont = oRead.ReadToEnd()
            MainBox.Text = filecont
            oRead.Close()

        End If
    End Sub```

... I'm pretty sure it's something like that but that doesn't work... any ideas?

ghost's Avatar
0 0

Yes, to make it the default program to run the file right? But then as mentioned above it wouldn't actually open the file.


ghost's Avatar
0 0

Thought you needed a FileStream object to use the StreamReader on.