📄 macstuff.h
字号:
/*****************************************************************************/pascal OSErr DTOpen(ConstStr255Param volName, short vRefNum, short *dtRefNum, Boolean *newDTDatabase);/* Open a volume's desktop database and return the desktop database refNum. The DTOpen function opens a volume's desktop database. It returns the reference number of the desktop database and indicates if the desktop database was created as a result of this call (if it was created, then it is empty). volName input: A pointer to the name of a mounted volume or nil. vRefNum input: Volume specification. dtRefNum output: The reference number of Desktop Manager's desktop database on the specified volume. newDTDatabase output: true if the desktop database was created as a result of this call and thus empty. false if the desktop database was already created, or if it could not be determined if it was already created. Result Codes noErr 0 No error nsvErr -35 Volume not found ioErr -36 I/O error paramErr -50 Volume doesn't support this function extFSErr -58 External file system error - no file system claimed this call. desktopDamagedErr -1305 The desktop database has become corrupted - the Finder will fix this, but if your application is not running with the Finder, use PBDTReset or PBDTDelete*//*****************************************************************************/pascal OSErr HGetVolParms(ConstStr255Param volName, short vRefNum, GetVolParmsInfoBuffer *volParmsInfo, long *infoSize);/* Determine the characteristics of a volume. The HGetVolParms function returns information about the characteristics of a volume. A result of paramErr usually just means the volume doesn't support PBHGetVolParms and the feature you were going to check for isn't available. volName input: A pointer to the name of a mounted volume or nil. vRefNum input: Volume specification. volParmsInfo input: Pointer to GetVolParmsInfoBuffer where the volume attributes information is returned. output: Atributes information. infoSize input: Size of buffer pointed to by volParmsInfo. output: Size of data actually returned. Result Codes noErr 0 No error nsvErr -35 Volume not found paramErr -50 Volume doesn't support this function __________ Also see the macros for checking attribute bits in MoreFilesExtras.h*//*****************************************************************************/pascal OSErr DeleteDirectoryContents(short vRefNum, long dirID, ConstStr255Param name);/* Delete the contents of a directory. The DeleteDirectoryContents function deletes the contents of a directory. All files and subdirectories in the specified directory are deleted. If a locked file or directory is encountered, it is unlocked and then deleted. If any unexpected errors are encountered, DeleteDirectoryContents quits and returns to the caller. vRefNum input: Volume specification. dirID input: Directory ID. name input: Pointer to directory name, or nil when dirID specifies a directory that's the object. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found wPrErr -44 Hardware volume lock fLckdErr -45 File is locked vLckdErr -46 Software volume lock fBsyErr -47 File busy, directory not empty, or working directory control block open paramErr -50 No default volume dirNFErr -120 Directory not found or incomplete pathname afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ Also see: DeleteDirectory*//*****************************************************************************/pascal OSErr DeleteDirectory(short vRefNum, long dirID, ConstStr255Param name);/* Delete a directory and its contents. The DeleteDirectory function deletes a directory and its contents. All files and subdirectories in the specified directory are deleted. If a locked file or directory is encountered, it is unlocked and then deleted. After deleting the directories contents, the directory is deleted. If any unexpected errors are encountered, DeleteDirectory quits and returns to the caller. vRefNum input: Volume specification. dirID input: Directory ID. name input: Pointer to directory name, or nil when dirID specifies a directory that's the object. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found wPrErr -44 Hardware volume lock fLckdErr -45 File is locked vLckdErr -46 Software volume lock fBsyErr -47 File busy, directory not empty, or working directory control block open paramErr -50 No default volume dirNFErr -120 Directory not found or incomplete pathname afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ Also see: DeleteDirectoryContents*//*****************************************************************************/pascal OSErr DTSetComment(short vRefNum, long dirID, ConstStr255Param name, ConstStr255Param comment);/* Set a file or directory's Finder comment field. The DTSetComment function sets a file or directory's Finder comment field. The volume must support the Desktop Manager because you only have read access to the Desktop file. vRefNum input: Volume specification. dirID input: Directory ID. name input: Pointer to object name, or nil when dirID specifies a directory that's the object. comment input: The comment to add. Comments are limited to 200 characters; longer comments are truncated. Result Codes noErr 0 No error nsvErr -35 Volume not found ioErr -36 I/O error fnfErr -43 File or directory doesnt exist paramErr -50 Volume doesn't support this function wPrErr -44 Volume is locked through hardware vLckdErr -46 Volume is locked through software rfNumErr -51 Reference number invalid extFSErr -58 External file system error - no file system claimed this call. desktopDamagedErr -1305 The desktop database has become corrupted - the Finder will fix this, but if your application is not running with the Finder, use PBDTReset or PBDTDelete __________ Also see: DTCopyComment, FSpDTCopyComment, FSpDTSetComment, DTGetComment, FSpDTGetComment*//*****************************************************************************/pascal OSErr FSpDTSetComment(const FSSpec *spec, ConstStr255Param comment);/* Set a file or directory's Finder comment field. The FSpDTSetComment function sets a file or directory's Finder comment field. The volume must support the Desktop Manager because you only have read access to the Desktop file. spec input: An FSSpec record specifying the file or directory. comment input: The comment to add. Comments are limited to 200 characters; longer comments are truncated. Result Codes noErr 0 No error nsvErr -35 Volume not found ioErr -36 I/O error fnfErr -43 File or directory doesnt exist wPrErr -44 Volume is locked through hardware vLckdErr -46 Volume is locked through software rfNumErr -51 Reference number invalid paramErr -50 Volume doesn't support this function extFSErr -58 External file system error - no file system claimed this call. desktopDamagedErr -1305 The desktop database has become corrupted - the Finder will fix this, but if your application is not running with the Finder, use PBDTReset or PBDTDelete __________ Also see: DTCopyComment, FSpDTCopyComment, DTSetComment, DTGetComment, FSpDTGetComment*//*****************************************************************************/pascal OSErr XGetVInfo(short volReference, StringPtr volName, short *vRefNum, UnsignedWide *freeBytes, UnsignedWide *totalBytes);/* Get extended information about a mounted volume. The XGetVInfo function returns the name, volume reference number, available space (in bytes), and total space (in bytes) for the specified volume. You can specify the volume by providing its drive number, volume reference number, or 0 for the default volume. This routine is compatible with volumes up to 2 terabytes. volReference input: The drive number, volume reference number, or 0 for the default volume. volName input: A pointer to a buffer (minimum Str27) where the volume name is to be returned or must be nil. output: The volume name. vRefNum output: The volume reference number. freeBytes output: The number of free bytes on the volume. freeBytes is an UnsignedWide value. totalBytes output: The total number of bytes on the volume. totalBytes is an UnsignedWide value. Result Codes noErr 0 No error nsvErr -35 No such volume paramErr -50 No default volume __________ Also see: HGetVInfo*//*****************************************************************************/pascal OSErr HGetVInfo(short volReference, StringPtr volName, short *vRefNum, unsigned long *freeBytes, unsigned long *totalBytes);/* Get information about a mounted volume. The HGetVInfo function returns the name, volume reference number, available space (in bytes), and total space (in bytes) for the specified volume. You can specify the volume by providing its drive number, volume reference number, or 0 for the default volume. This routine is compatible with volumes up to 4 gigabytes. volReference input: The drive number, volume reference number, or 0 for the default volume. volName input: A pointer to a buffer (minimum Str27) where the volume name is to be returned or must be nil. output: The volume name. vRefNum output: The volume reference number. freeBytes output: The number of free bytes on the volume. freeBytes is an unsigned long value. totalBytes output: The total number of bytes on the volume. totalBytes is an unsigned long value. Result Codes noErr 0 No error nsvErr -35 No such volume paramErr -50 No default volume __________ Also see: XGetVInfo*//*****************************************************************************/pascal OSErr GetDirName(short vRefNum, long dirID, Str31 name);/* Get the name of a directory from its directory ID. The GetDirName function gets the name of a directory from its directory ID. vRefNum input: Volume specification. dirID input: Directory ID. name output: Points to a Str31 where the directory name is to be returned. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found paramErr -50 No default volume or name parameter was NULL dirNFErr -120 Directory not found or incomplete pathname afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname*/#endif /* _MACSTUFF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -