Macintosh QuickBASIC Program to Hide/Unhide File in Finder

Article translations Article translations
Article ID: 40887
This article was previously published under Q40887
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

SUMMARY

Below is a Macintosh QuickBASIC Version 1.00 program that makes a file invisible on the Macintosh desktop. Even though it is invisible, the file can still be accessed by an application and can be read and written to, e.g. QuickBASIC can still open the file.

The program example uses the GetFileInfo and SetFileInfo routines (i.e., MBLC routines in QuickBASIC), which are not provided in earlier releases of BASIC interpreter or compiler for Macintosh.

MORE INFORMATION

The following is a program example:
' Hides a visible file or unhides an invisible file
DEFINT A-Z
DIM FILEINFO(40)
FILENAME$ = "myfile"
GetFileInfo FILENAME$,FILEINFO(0)
FILEINFO(20) = FILEINFO(20) XOR 16384
SetFileInfo FILENAME$,FILEINFO(0)
END
				
The contents of the FILEINFO array can be found in "Inside Macintosh" Volume II on Page 116 (by Apple Inc., published by Addison-Wesley). In this array, the Finder information is stored in parameter block 32 (i.e., element 16 in the array). The Finder information block is 16 bytes long. These 16 bytes are described on Page 130. They are as follows:
   fdType      OStype {file type}
   fdCreator   OStype {file's creator}
   fdFlags     INTEGER {flags}
   fdLocation  Point {file's location}
   fdFldr      INTEGER {file's window}
				
The fdFlags are used to determine if the file is visible to the Finder. The constant 16384 is XORed to the flag's value to determine if the file should be visible or not.

Properties

Article ID: 40887 - Last Review: February 27, 2014 - Revision: 1.2
Keywords: 
kbnosurvey kbarchive KB40887

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com