[futurebasic] Re: [FB] Force immediate update of folder window in finder?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2003 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 1 Sep 2003 16:58:13 +1200
On Sunday, August 31, 2003, michael evans wrote:

> Finder folder windows in OSX do not seem to update until clicked in and
> brought to the front.
>
> Is there any way to force a Finder folder window to update immediately 
> from
> FB^3? Using, say, an fsspec of the folder?


toolbox fn FSpMakeFSRef( const FSSpec *source, FSRef * newRef) = OSErr
toolbox fn FNNotify( const FSRef *ref, UInt32 message, UInt32 flags ) = 
OSStatus
_kFNDirectoryModifiedMessage = 1

/*
Notify the Finder (and any other interested parties) that the content
of this file's parent folder has changed,  The fileSpec passed should
normally refer to a file that you have created, deleted or renamed.
*/
local fn NotifyChangesInParentFolder( fileSpec as ^FSSpec )
'~'1
dim as FSSpec    parentFolderSpec
dim as OSStatus  err
dim as FSRef     parentFolderFSRef

err = fn FSMakeFSSpec( fileSpec.vRefNum, fileSpec.parID, "", 
@parentFolderSpec )
if ( err == _noErr ) then err = fn FSpMakeFSRef( parentFolderSpec, 
@parentFolderFSRef )
if ( err == _noErr ) then err = fn FNNotify( parentFolderFSRef, 
_kFNDirectoryModifiedMessage, 0 )
end fn = err


// demo main program
dim as FSSpec    fs
dim as OSStatus  err
long if ( files$( _FSSpecOpen,,, fs ) != "" )
err = fn NotifyChangesInParentFolder( fs )
if ( err ) then stop "Error " + str$( err )
end if



Robert P.