Dear friends...I want to design an application that can open file of certain extensions
For ex.There is a software called ARJ32 which can open file with extensions .a00 ,.a01...................,.a19.
also there is application called apk emulator which can open .apk files
So eve i want to design an application that an open certain file extensions
Is it possible???
How do i start??
I am well versed with c,c++,Java,VB.NET

Its not depend on any language.

If you want that any file formate like (*.xyz) open with your application. Then you have to create a sub-key on registry....

using Microsoft.Win32;
Registry
    .ClassesRoot
    .CreateSubKey(".xyz")
    .SetValue("", "XYZ", RegistryValueKind.String);
Registry
    .ClassesRoot
    .CreateSubKey("XYZ\shell\open\command")
    .SetValue("", "XYZProcessor \"%1\"", RegistryValueKind.String);
Comments
down voted for not being vb.net code in a vb.net forum.

Wow this is d first time I have come across such code...thank you for your help ...I would definitely try that..

You will also need to have your app. know what to do with the file once it is assigned to load it.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each arg As String In My.Application.CommandLineArgs
            MsgBox(arg) '// get full path of file.
            '// do what you want with file afterward.
        Next
    End Sub
End Class

To test this quickly, build your app., create a file with any type of file.extension, right click the file and select "Open" or "Open With".
Locate your recently build app. and select it. A MsgBox should appear with the file's full path. Afterward, that assigned file extension, if selected to always use that program to load it, should have your app.'s icon on it and double clicking it should automatically load it in your app..

Hope this helps.

Or you can create a file with that extension, then from an Explorer window, right click on that file and choose "Open With". From there you can select your custom program and select "Always open with this program".

You can also do this from Control Panel -> Default Programs

Either way is safer than modifying the Registry directly

Edited 5 Years Ago by Reverend Jim: clarification

Its not depend on any language.

If you want that any file formate like (*.xyz) open with your application. Then you have to create a sub-key on registry....

using Microsoft.Win32;
Registry
    .ClassesRoot
    .CreateSubKey(".xyz")
    .SetValue("", "XYZ", RegistryValueKind.String);
Registry
    .ClassesRoot
    .CreateSubKey("XYZ\shell\open\command")
    .SetValue("", "XYZProcessor \"%1\"", RegistryValueKind.String);

Well i am getting "Declaration expected error" on Registry...wat do i do now???

Post your code, easier to figure out why you're getting an error.

Imports Microsoft.Win32


Public Class Form1
  Registry.ClassesRoot
    Registry.CreateSubKey(".xyz")
    Registry.SetValue("", "XYZ", RegistryValueKind.String);
Registry.ClassesRoot
    Registry.CreateSubKey("XYZ\shell\open\command")
    Registry.SetValue("", "XYZProcessor \"%1\"", RegistryValueKind.String);  

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Error:Declaration expected...

See if this helps.
1 Button

Imports Microsoft.Win32
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each arg As String In My.Application.CommandLineArgs
            MsgBox(arg) '// get full path of file.
            '// do what you want with file afterward.
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With My.Computer.Registry.ClassesRoot
            .CreateSubKey(".myCoolFileExtension").SetValue("", "myCoolFileExtension", RegistryValueKind.String)
            .CreateSubKey("myCoolFileExtension\shell\open\command").SetValue("", Application.ExecutablePath & " ""%l"" ", RegistryValueKind.String)
        End With
        MsgBox("Done." & vbNewLine & "Double click any file on your p.c. with the "".myCoolFileExtension"" as a file extension, to have it load in your app. by default.", MsgBoxStyle.Information)
    End Sub
End Class

Registry code boosted from here: http://www.codeproject.com/KB/vb/VBFileAssociation.aspx

I have not bothered coding in the Registry, until now:D, although I do have a feeling that the ""%l"" in the above code should actually be a "1", not a .LowerCase "L".

Edited 5 Years Ago by codeorder: n/a

This question has already been answered. Start a new discussion instead.