FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

windows-command-for-document-type

Arguments: file-type &key path

This function exists on the Windows platform only.

Returns a command-line string that can be used with run-shell-command (or perhaps the Windows API function WinExec) to invoke whatever program is registered for handling files of a specified file type.

file-type should be a pathname-type string such as "bmp" for Windows bitmap files. The string case does not matter.

path may be a pathname or path namestring of a document to pass as a command line argument to the program, or else nil. If a path, then the returned string is a complete command containing the path, and it may be passed directly to run-shell-command. If nil, then the returned string will contain "%1" where the command line argument would be inserted, if one is accepted.

Examples

This form uses run-shell-command to invoke the registered PDF-displaying program to display the AllegroCache tutorial. (The :winapi module must be loaded; evaluate (require :winapi).)

;; The winapi module must be loaded for these examples to work
(require :winapi)

(run-shell-command
  (windows-command-for-document-type
    "pdf"
    :path (merge-pathnames
            "acache/doc/acachetutorial.pdf"
            (translate-logical-pathname "sys:"))))

This form does the same thing using WinExec.

(with-native-string
    (native (windows-command-for-document-type
             "pdf"
             :path (merge-pathnames
                     "acache/doc/acachetutorial.pdf"
                     (translate-logical-pathname "sys:"))))
  (win:WinExec native win:SW_SHOWNORMAL))

Registering a program for a particular file type

(setf windows-command-for-document-type) can be called to register a particular program for some file type. This setf function does not have the path argument. The file-type argument should be the same as above, and the value should be the command line string to execute for that file type. This sets the global registry value for the file type, and so it should not be done without an explicit request from the user.


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version