Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 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-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version