Question How to add ' Edit with "my software" ' on right click on text file

MrQwertz

Member
Joined
Jul 23, 2012
Messages
8
Programming Experience
1-3
Hello guys. Is it possible to add ' Edit with "my software" ' on right click on some text files. For example this:


edit_with_notepad.jpg


Thank you very much!​
 
MrQwertz, other seeing a lot of room for improvement with your overall code, I don't see code that gets and uses any commandline arguments. Typically you would either use the Application Start event or the main form's Form Load event to read in those arguments and do whatever needs to be done.

In your case you could add this code to your Form_Load event:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Maximized
        RichTextBox1.ZoomFactor = "1"
        RichTextBox1.AllowDrop = True
        'This registery code doesn't work
        'This app does not have permissions to write to that part of the registery
        'This registery change should be done by the installer, not this application
        'My.Computer.Registry.SetValue("HKEY_CLASSES_ROOT\PAWN.Script\shell\Check with BracketFinder\command", "", "C:\Documents and Settings\Anis\My Documents\Visual Studio 2010\Projects\BracketFinder\BracketFinder\bin\Release\BracketFinder.exe")
        If Environment.GetCommandLineArgs.Count > 1 Then
            Dim Arg1 As String = Environment.GetCommandLineArgs(1)
            If System.IO.File.Exists(Arg1) Then Call OpenFile(Arg1)
        End If
    End Sub

    Private Sub OpenFile(ByVal Path As String)
        Dim sr As System.IO.StreamReader = Nothing
        Try
            sr = New System.IO.StreamReader(Path)
            RichTextBox1.Text = sr.ReadToEnd()
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Error reading file")
        Finally
            If sr IsNot Nothing Then
                sr.Close()
                sr.Dispose()
            End If
        End Try
    End Sub


Also, what's wrong with attaching the zip file to a forum post here?
 
Back
Top