file-association

Getting File Associations using Windows API

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 18:50:59
问题 I'm working on a console based file browser for Windows in C++ and am having difficulties getting together a context menu that lists actions associated with a file and calls commands on them. The biggest issue right now is getting the actions tied to the file types. I know of the process to open and tweak the registry keys in HKEY_CLASSES_ROOT but I can't find a way to actually get the actions and their commands so I can build a context menu out of it. The general structure of these

Is there an easy way to determine what a file is by its extension in C#?

≡放荡痞女 提交于 2019-11-30 16:23:35
Is there an easy way to determine what a file is by its extension in C#? For example if I pass a file extension of ".txt" then it will return "Text Document" or if I pass it ".pdf" it will return "Adobe Acrobat Reader". I see this behavior built into Windows Explorer, under the "Type" column. Is there a way to mimic this in C#? If you want to get what explorer actually shows and are willing to use COM inter-op you can use the Shell.Application class to get it with the minimum amount of code. If you go to add a reference, browse to X:\windows\system32\shell32.dll that will import shell32's type

How to programmatically create a file association that works in XP, Vista and Windows 7

北城余情 提交于 2019-11-30 15:37:17
问题 I want to be able to register my file-extension from my program. (Associate the filetype with my program) There are lots of articles about this, but the technique discussed (fiddling with the registry) is only appropriate for Windows XP as far as I see. What is the best way to associate a filetype with a program so that it works under XP, Vista and Windows 7 as well ? (Are there any working code-examples ?) ClickOnce would be an option, but this only registers the filetype at installation

Why doesn't virtualenv on Windows associate .py/.pyw/.pyo/.pyc files with virtualenv's version of Python executables?

别等时光非礼了梦想. 提交于 2019-11-30 14:01:14
What is the reason virtualenv does not associate .py(w) files with virtualenv's version of Python executables? This seems like an ideal task for virtualenv on Windows taking into consideration that there's no mechanism like shebang on Windows. File type associations are handled in the Windows registry. The virtualenv activate script would have to modify the registry keys and the deactivate script would need to restore the previous value (or risk breaking the associations). What happens if you activate a virtualenv, open a second instance of cmd.exe, and activate a different virtualenv? Unless

Java - Creating a new file extension in a program

最后都变了- 提交于 2019-11-30 13:39:43
I'm aiming to create a new file extension (possibly more than one) for a program I'm creating. So, after looking around for a bit, I found a number of sources on the subject, listed below, just in case anyone wants to look at them and get the general idea of what I have been looking at. Utilising a file association in a Java application Create registry entry to associate file extension with application in C++ Associating file extensions with a program http://support.microsoft.com/?scid=kb%3Ben-us%3B185453&x=6&y=11 http://www.rgagnon.com/javadetails/java-0592.html http://www.rgagnon.com

How do I add my application in the Default Programs list of Windows Vista/7?

大城市里の小女人 提交于 2019-11-30 07:10:37
So many programs feature a list of possible extensions and protocols under the "Default Programs" control panel applet. "Set Default PRograms", more precisely. (Vista & 7) I wish to add my programs in that list and set some extensions that it can handle. One more thing. My program supports addons for opening more files, so that list should be dynamic (I can add more extensions or even protocols at any time) By the way, yes, I know, this is not exactly a programming question. It'd be my humble guess that it's a registry question. So UAC will not be an issue! The registry keys required to

How do you change file association for .py Python files in XP?

倖福魔咒の 提交于 2019-11-30 06:48:20
问题 When I type assoc .py I get .py=py_auto_file . When I type ftype py_auto_file I get py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1" How do I make py_auto_file="C:\Python27" ? 回答1: It appears Photoshop may recognize a .py file format and has associated "py_auto_file" with the .py extension. You can use the following command to locate the python file types: C:\>ftype | findstr -i python Python.CompiledFile="C:\Python27\python.exe" "%1" %* Python.File="C:\Python27\python

Why doesn't virtualenv on Windows associate .py/.pyw/.pyo/.pyc files with virtualenv's version of Python executables?

狂风中的少年 提交于 2019-11-29 19:55:12
问题 What is the reason virtualenv does not associate .py(w) files with virtualenv's version of Python executables? This seems like an ideal task for virtualenv on Windows taking into consideration that there's no mechanism like shebang on Windows. 回答1: File type associations are handled in the Windows registry. The virtualenv activate script would have to modify the registry keys and the deactivate script would need to restore the previous value (or risk breaking the associations). What happens

Java - Creating a new file extension in a program

狂风中的少年 提交于 2019-11-29 19:06:51
问题 I'm aiming to create a new file extension (possibly more than one) for a program I'm creating. So, after looking around for a bit, I found a number of sources on the subject, listed below, just in case anyone wants to look at them and get the general idea of what I have been looking at. Utilising a file association in a Java application Create registry entry to associate file extension with application in C++ Associating file extensions with a program http://support.microsoft.com/?scid=kb

Open specific file type with Python script?

白昼怎懂夜的黑 提交于 2019-11-29 09:58:15
How can I make a Python script to be a specific file type's (e.g., *.foo) default application? As in, when I double click the file in the Finder / Explorer I want the file to open in the Python script. Is this possible to do in Win and/or OS X? The application is a PySide app if that matters. Mac OS X On Mac OS X you can use Automator to create an application that calls your python app and passes the input file path as a string argument. In the application workflow wizard, add action "Run Shell Script", select Pass input: as as arguments , and in the text box add: python /path/to/my/app/myapp