Michael Li schrieb: > hi, > > In Windows, there is a default way to open a file, > like double click test.txt file, then Notepad will > open the test.txt, double click test.doc, then > MS-Word will open the test.doc. > > If I want to open a specific file, test.KEY, > with my application, how do I do it ? > The suffix ".KEY" is fixed. > More specific, I have a file test.KEY in > C:\DEFORM3D\PROBLEM\test.KEY > my application is in C:\DEFORM3D\V6_0\DEF_GUI3.EXE, > > You have to modify some registry values. The Inno Setup FAQ http://www.jrsoftware.org/isfaq.php#assoc describes how:
[Registry] Root: HKCR; Subkey: ".myp"; ValueType: string; ValueName: ""; ValueData: "MyProgramFile"; Flags: uninsdeletevalue ".myp" is the extension we're associating. "MyProgramFile" is the internal name for the file type as stored in the registry. Make sure you use a unique name for this so you don't inadvertently overwrite another application's registry key. Root: HKCR; Subkey: "MyProgramFile"; ValueType: string; ValueName: ""; ValueData: "My Program File"; Flags: uninsdeletekey "My Program File" above is the name for the file type as shown in Explorer. Root: HKCR; Subkey: "MyProgramFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MYPROG.EXE,0" "DefaultIcon" is the registry key that specifies the filename containing the icon to associate with the file type. ",0" tells Explorer to use the first icon from MYPROG.EXE. (",1" would mean the second icon.) Root: HKCR; Subkey: "MyProgramFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MYPROG.EXE"" ""%1""" "shell\open\command" is the registry key that specifies the program to execute when a file of the type is double-clicked in Explorer. The surrounding quotes are in the command line so it handles long filenames correctly. One can of course modify the same registry values using a python program. _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32