Hello,
I'd like to know how to register filetypes to my application. It is a picture viewer program, and i'd like to register eg jpg files to it through an option in my program.
the main problem is how to register the filetype.
could anyone help
thnx

registering filetypes to an app
Cathie 64
Hello Mubshir Raza Ali,
Unfortunatelly i don't have setup or installer template. could you gimme a link to download it
thnx
wls1973
Hi Slyke,
To do what your asking your program needs to have a main method, the main method is the first method to get called in all applications, VB hides it from you. You will need to create one. The main method is passed an array of strings that define the arguments used to open the application.
You need to check the length and value of the arguments and process the applications parameters depending on what your looking to do.
Here's an example...
Public
Module MyApplication<STAThread()> _
Public Sub Main(ByVal Args() As String) 'if there are no command prompt arguments 'then just loads and display the main form If Args.GetLength(0) = 0 Then 'run the application with the main formApplication.Run(
New frmMainForm) ElseIf Args.GetLength(0) = 1 Then 'if there is one argument then it's a filename and path caused by shell Open verb Dim udtForm As New frmMainForm 'open the file Args(0) and display in the main formApplication.Run(udtForm)
ElseIf Args.GetLength(0) > 1 Then Dim arg As IEnumerator = Args.GetEnumerator 'for each command prompt argument Do While arg.MoveNext Select Case CType(arg.Current, String) Case "-p" ' file name passed to the control panel is to be printed'call print method in here
End Select
Loop
End If
End Sub
End Module
Witek
R2 DJ
Hi,
Setup Project Template is available (in VS2005) at...
File>New>Project
Other Project Types > Setup and Deployment > Setup Project
Normally these templates are available by default with the setup. So you might have not selected them during installation...
You can run setup again and install them....
I am not sure if they are availabel online, but if i found some link sure i will give you.
Fredrik Melin
beto81
Hi Attila Fogel,
Setup Project provide this facility...
Add a setup project (You can find setup project in project templates from Other Projects>Setup & Deployment) for your project installation on client machines.
Now in setup project there is option to Add file types and associate icons that setup will register on client machine when your software is installed.
You can access File types editor by selecting the Setup project, when you select the project file in solution explorer there will be toolbar at top from there you will fine file type editor (and few other editors) when you click on it file type editor will open.
Now you can add file types as many you need and you can associate icons and actions with them.
(How ever you can write your own code for that by setup project is the most recomended way)
Hope this help.
Stephen Lim
I got it working so when i click "Open" it launches my program.
However, how can i tell it to perform commands such as "Print" I looked in the reg and it has like "C:\WINDOWS\system32\NOTEPAD.EXE %1" for jsut open, or edit"
But it has "C:\WINDOWS\system32\NOTEPAD.EXE /p %1" for print. How can i use something like /p in my program When i tried it, nothing happens. (I used a msgbox to show the file that it was opening and anything else that was on teh end of it, such as a /p but the msgbox didn't even open!). How can i execute subs or functions when the program has startup from a file like what i'm trying to explain
BobH
Hi,
Ok anyway if setup project is not availabe then you can write your own code to associate file types..
Working with file type association!
Hope this help.