Please Help....How to open a file in application?
-
Really need help guys!! Am just a newby in .Net programming, i am using visual studio 2005 and studying C# programming language. I am building a utility software that would need to be opened by clicking or double-clicking the file built by my application using its own file extensions, much like zip files in windows explorer loading on WinZip etc... Really need help... Please anyone..Sample C# 2005 codes would be very much appreciated. Thank you!!! .............
-
Really need help guys!! Am just a newby in .Net programming, i am using visual studio 2005 and studying C# programming language. I am building a utility software that would need to be opened by clicking or double-clicking the file built by my application using its own file extensions, much like zip files in windows explorer loading on WinZip etc... Really need help... Please anyone..Sample C# 2005 codes would be very much appreciated. Thank you!!! .............
[STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if(args == null || args.Length == 0) Application.Run(new Form1()); else Application.Run(new Form1(args[0])); }
args is the parameter list. if you open app through file the first parameter is the file name.. then you can do whatever you want with it..life is study!!!
-
Really need help guys!! Am just a newby in .Net programming, i am using visual studio 2005 and studying C# programming language. I am building a utility software that would need to be opened by clicking or double-clicking the file built by my application using its own file extensions, much like zip files in windows explorer loading on WinZip etc... Really need help... Please anyone..Sample C# 2005 codes would be very much appreciated. Thank you!!! .............
-
[STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if(args == null || args.Length == 0) Application.Run(new Form1()); else Application.Run(new Form1(args[0])); }
args is the parameter list. if you open app through file the first parameter is the file name.. then you can do whatever you want with it..life is study!!!
"args is the parameter list. if you open app through file the first parameter is the file name.. then you can do whatever you want with it.. " -what do you mean, i'm sorry i don't get it..in vs 2005 these lines are included in the Program.cs file, isn't it? These are my codes in my main form using the Form_Load Event. RegistryKey rk = Registry.ClassesRoot.CreateSubKey(".sis",RegistryKeyPermissionCheck.ReadWriteSubTree); rk.SetValue("Content Type", "application/x-sis"); rk.SetValue("PerceivedType", "file collections"); rk.SetValue("", "SIS"); rk.CreateSubKey("OpenWithList"); RegistryKey rk2 = Registry.ClassesRoot.CreateSubKey("SIS", RegistryKeyPermissionCheck.ReadWriteSubTree); rk2.SetValue("", "SIS File"); rk2.CreateSubKey("DefaultIcon",RegistryKeyPermissionCheck.ReadWriteSubTree); try { RegistryKey rk3 = Registry.ClassesRoot.OpenSubKey("SIS", true).OpenSubKey("DefaultIcon", true); rk3.SetValue("", "C:/sis.ico"); RegistryKey rk4 = Registry.ClassesRoot.OpenSubKey("SIS", true); rk4.CreateSubKey("shell", RegistryKeyPermissionCheck.ReadWriteSubTree); RegistryKey rk5 = Registry.ClassesRoot.OpenSubKey("SIS", true).OpenSubKey("shell", true); rk5.CreateSubKey("open", RegistryKeyPermissionCheck.ReadWriteSubTree); RegistryKey rk51 = Registry.ClassesRoot.OpenSubKey("SIS", true).OpenSubKey("shell", true).OpenSubKey("open", true); rk51.SetValue("", "Open with &SIS"); RegistryKey rk6 = Registry.ClassesRoot.OpenSubKey("SIS", true).OpenSubKey("shell", true).OpenSubKey("open",true); rk6.CreateSubKey("command", RegistryKeyPermissionCheck.ReadWriteSubTree); RegistryKey rk66 = Registry.ClassesRoot.OpenSubKey("SIS", true).OpenSubKey("shell", true).OpenSubKey("open", true).OpenSubKey("command", true); rk66.SetValue("", "C:/SIS.exe"); RegistryKey rkapp = Registry.ClassesRoot.OpenSubKey("Applications", true); rkapp.CreateSubKey("SIS.exe", RegistryKeyPermissionCheck.ReadWriteSubTree); RegistryKey rkapp2 = Registry.ClassesRoot.OpenSubKey("Applications", true).OpenSubKey("SIS.exe", true); rkapp2.CreateSubKey("shell", RegistryKeyPermissionCheck.ReadWriteSubTree); RegistryKey rkapp3 = Registry.ClassesRoot.OpenSubKey("Applications", true)
-
I think you need the File Types Editor in your deployment setup project: http://msdn2.microsoft.com/en-us/library/c219k91z(VS.80).aspx[^]
I've posted my block of codes, please try to look deep into it, im gettin the access denied upon clicking or right clicking and choosing "Open with SIS", the registered file with my own file extensions still have unknown applications on its properties.... I need a way on these without deployment yet. Is there any other way? PLEASE....
-
I've posted my block of codes, please try to look deep into it, im gettin the access denied upon clicking or right clicking and choosing "Open with SIS", the registered file with my own file extensions still have unknown applications on its properties.... I need a way on these without deployment yet. Is there any other way? PLEASE....
-
Sorry I'm not really familiar with the necessary registry updates but this might help you: http://www.codeproject.com/shell/cgfiletype.asp[^]
-
Thank you so much anyway..., but favor please, if you'd have d idea on how to manage these problems written in C#, please do "message me here"..Tnx.
Seems you are already on the right track. Remember your application must open the file using the arg[0](path to your file) parameter from the Main method. static void Main(strings[] args) { if (args.Length <> 0) Open(args[0]);//implement Open else Application.Run(new Form1()); } I would do the following: 1) For testing purposes use the setup project (Set Open as default etc) and confirm the registry entries created by your setup project. Confirm double-click works. 2) Use C# to update the registry - compare with setup project entries to confirm what entries you may be missing. Best of luck!!
-
Seems you are already on the right track. Remember your application must open the file using the arg[0](path to your file) parameter from the Main method. static void Main(strings[] args) { if (args.Length <> 0) Open(args[0]);//implement Open else Application.Run(new Form1()); } I would do the following: 1) For testing purposes use the setup project (Set Open as default etc) and confirm the registry entries created by your setup project. Confirm double-click works. 2) Use C# to update the registry - compare with setup project entries to confirm what entries you may be missing. Best of luck!!
-
[STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if(args == null || args.Length == 0) Application.Run(new Form1()); else Application.Run(new Form1(args[0])); }
args is the parameter list. if you open app through file the first parameter is the file name.. then you can do whatever you want with it..life is study!!!