[futurebasic] FINDERINFO

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Fri, 01 Jan 1999 18:46:07 -0600
Yes, I know I'm supposed to use Apple Events instead, but I just thought
I'd experiment with the FINDERINFO command, which looked considerably
easier to implement.

I can't get it to work at all.  I wrote the following little demo, and
put in the right FREF and BNDL resources, which tell the Finder that my
program can open TEXT files.  I am able launch the program by
double-clicking a TEXT file created by "FInf", or by dragging a TEXT
file to the app's icon.  I've run it on 3 machines, using OS 8.0, 7.5
and 7.1 respectively.  In every case, "action" returns garbage and
"count" returns zero.  I can't see anything wrong with the code.  Does
FINDERINFO only work with system versions older than 7.1?

RESOURCES "finderinfo.rsrc", "APPLFInf"
_maxItems = 5
DIM 31 item$(_maxItems), type&(_maxItems), wdRefNum(_maxItems)
HANDLEEVENTS  'necessary?
count = _maxItems
action = FINDERINFO(count, item$(0), type&(0), wdRefNum(0))
PRINT "action:"; action
PRINT "count:"; count
LONG IF count > 0
  FOR i = 0 TO count - 1
    PRINT item$(i), MKI$(type&(i)), wdRefNum(i)

Any obvious goofs here?

- Rick