All Manuals > LispWorks® User Guide and Reference Manual > 48 Miscellaneous WIN32 symbols

tstr

lpctstr

lptstr FLI Type Descriptors

Summary

Types which automatically switch between ANSI and Unicode strings.

Package

win32

Syntax

tstr &key length

lpctstr &key max-length

lptstr &key max-length

Arguments
length
An positive integer.
max-length
An positive integer.
Description

tstr is an ANSI/Unicode string containing length elements.

lpctstr is a reference-pass pointer to ANSI/Unicode string containing at most max-length elements.

lptstr is a reference (in/out) pointer to an ANSI/Unicode string containing at most max-length elements.

Each of these three types automatically switch between ANSI and Unicode, which makes them ideal for use with the :dbcs encoding option in fli:define-foreign-function.

Examples

This calls GetDriveTypeA on Windows ME, and GetDriveTypeW on supported versions of Windows.

The argument is passed as ANSI or Unicode respectively:

(fli:define-foreign-function (%get-drive-type "GetDriveType" :dbcs)
    ((lpRootPathName W:LPCTSTR))
    :result-type (:unsigned :int))
 
(defconstant +drive-types+
   #(:unknown :none :removable :fixed :remote :cdrom :ramdisk))
 
(defun get-drive-information (drive)
  (the drive-type (svref +drive-types+ (%get-drive-type drive))))

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:08