You're spot on, Peter. The fifth bit in the File Attribute value is set when the "file" is a directory, and if no other bits are set, that results in the attribute value being 16. Until Windows2000, I had never seen a directory with the archive bit set too. So I was naively checking for File Attribute = 16, which was failing because the value was actually 48 (2^4 + 2^5 = 48). What I needed to do was just check the directory bit. This code does the trick for checking bitfields:
if nFilleAttr \ 2^4 mod 2 then 'bit 4 (counting from zero) is set end if The integer divide makes a nice right-shift operator, and the mod 2 tests the right-most bit. The result is either 1 or 0. - Bill Thoen Peter Horsboll Moller wrote: > > Well, I stumpled upon something that might explain this: > A couple of weeks ago I was made aware of a problem in my own function to > create a list of existing directories in a certain directory. > > The problem was that the Archive bit had been turned on for some of the > directories and that these didn't show. So to be sure whether a certain > "file" is a directory you have to check if the "type" is larger than 16, and > if so if 16 is "included in the value. > > Note the File Attribute value can be 1, 2, 4, 8, 16, 32, 64 etc and allmost > every combination of these. > > HTH, > Peter > COWI A/S > > -----Original Message----- > From: Bill Thoen > To: MapInfo-L > Sent: 27-12-02 19:33 > Subject: MI-L FindFirstFile API problem with Win2K > > Has anyone had any problem with MapBasic and the Windows APIs > FindFirstFile and FindNextFile when searching for directories > only over a mapped network drive in a Win2K environment? > > I have a MapBasic function that searches for directories (i.e. > File attribute=16) using these calls that's been working great > for years. It works on Win98 to ExPee. But on one particular > environment (a Windows 2000 network) when the user tries to list > the directories on the server via a mapped network drive, it > shows nothing. Any ideas what might be happening? > --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 4715
