| FAQ по Visual Basic |
| Содержание / Разное |
|
|
§ 8.1. Как связать конкретное расширение файлов со своей программой?
Читаем в том же MSDN: Supporting Context Menu OperationsYour installation program can provide support for Context menu operations, such as Open, Print, and Print To, by setting appropriate registry entries. The Context appears when the user clicks the right mouse button on a document associated with your application. Enabling "Print" in the registry gives the shell instructions about what to execute when the user selects Print from the Context menu. Usually an application will display a dialog that says "Printing page X of N on LPTX". Enabling "Print To" in the registry specifies the default action for "drag print."Print To" displays the same dialog box as "Print" when you drag to a specific printer. The "Print To" option is not displayed on the menu, so it does not bring up anything (that is, it cannot be selected). The following example shows how to set commands for the Context menu for files having the .TXT and .RTF filename extensions:
Adding the Application to the Start ButtonYour installation program can still create a "Program Group" in the Programs folder by using dynamic data exchange (DDE) as used in Windows version 3.1. However, this is no longer the preferred method. Instead, your installation program should add an icon for your primary application to the Start Programs menu. The program can, optionally, prompt the user to choose which program icons to place in the menu, but icons should not be added for every application in your package and an extensive hierarchy of programs and folders should not be created on this menu. To add an icon to the Start program menu, your installation program should create a link to your application's executable file and place the link in the \WINDOWS\STARTMEN\PROGRAMS directory. (Note that the \WINDOWS directory should actually be the path returned by the GetWindowsDirectory function.) An installation program can create a link by using the IShellLink interface. Using Filename ExtensionsIn Windows 95, filename extensions should always describe a file type. Your installation program should not rename old or backup files by changing them to filename extensions such as .001 or .BAK or .XX1. If the file type does not change, the program should give the file a new name. For example, it can use long filenames to change the old version of a filename, such as SAMPLE.DLL, to Copy of SAMPLE.DLL. The following table lists filename extensions currently used in Windows. Do not use these filename extensions unless your file fits the given type description.
Also investigate extensions commonly used by popular applications so you can avoid creating a new extension that might conflict with them, unless you intend to replace or supersede the functionality of those applications. То есть все сводится к созданию определенных записей в реестре. См. также § 5.22. Как работать с реестром?
Автор: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Предыдущий раздел | Следующий раздел |
| © 2004. При цитировании, пожалуйста, не забудьте поставить ссылку на оригинальную страницу. |