FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 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-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.2. This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Unrevised from 8.1 to 8.2.
8.1 version