hi,
i am developing an application in C#.For saving the state of an application i am using a custom file format.Now suppose a user using the application want to save the state of the application he can save it as "savedstate.abcd" where .abcd is the new extension to be supported by my application.Now when he double clicks on this saved file named "savedstate.abcd" my application will open up and the objects being used in my application will be instantiated with the saved data.
i have done addition in the registry so than when a user double clicks file with my extension ".abcd" the application will start.but how do i read the application state from my saved file because my application does not know on which file the user clicked.
i need to connect to file on which the user double clicked so as to read the information from it......how can i do it.
please help or point me in some direction where i can lookout on my own.

how to open ur custom file format in ur application
colombod
I am assuming you have already registered the extension with ur application.
In that case when you doubleclick on say Sample.abcd in C:\Temp, then the args[0] will have a string that has the complete path to the file including the filename.
args[0] will have the value "C:\Temp\Sample.abcd".
Let me know if you need more clarifications.
Regards,
Vikram
Albert Raiani
BennyAndGisela
one
SupurbSoftEng
thanks to jmcilhinney also.
regards
Ramneek
SurySuman
regards
ramneek
comparch
So you would need to write your main method as follows if u are using a Windows Forms application:
[STAThread]
static void Main(string[] args)
{
if (args.Length > 0)
Application.Run(new Form1(args[0]));
else
Application.Run(new Form1());
}
And also you would need to add a separate constructor to your Form, which starts up to capture the value.
Regards,
Vikram