Page 1 of 1

Help needed reading a folders content

Posted: Thu Jun 12, 2003 2:16 pm
by Large
Hi Guys,

I need a little help here . . .

I need make an icon on the taskbar flash or change appearance depending if a folder on my server is empty or not.

ie : flashing icon if this folder has stuff in it.
ie : a solid icon if its empty.

Also this little program has to check this folder every 10 mins or so !

I think I can work out the icon bit but how can I determine whether a folder is empty or not.

Any help would be greatly appreciated.

Kind regards

Andy ( aka Large )

Posted: Thu Jun 12, 2003 6:39 pm
by GedB
Andy,

Take a look at the following API example. (It will only work with a registered copy).

It sets up a notification hook on a directory. If the contents of the folder change your program is notified.

Code: Select all

;Converted from a VB example by:
    ;KPD-Team 2000
    ;URL: http://www.allapi.net/
    ;E-Mail: KPDTeam@Allapi.net


;Set the notification hook
Ret = FindFirstChangeNotification_("d:\test", $FFFFFFFF, #FILE_NOTIFY_CHANGE_FILE_NAME)
;Wait Until the event is triggered
WaitForSingleObject_(Ret, $FFFFFFFF)
MessageRequester("", "Event Triggered For the first time", 0)
;Reactivate our hook
FindNextChangeNotification_(Ret)
;Wait Until the event is triggered
WaitForSingleObject_(Ret, $FFFFFFFF)
MessageRequester("", "Event Triggered For the second time", 0)
;Remove our hook
FindCloseChangeNotification_(Ret)

Thanks

Posted: Thu Jun 12, 2003 7:09 pm
by Large
Mmmm, thanks GedB gives me an idea where to start !

Kind regards

Posted: Sat Jan 27, 2007 5:25 am
by PB
Or, to just see if a directory is empty or not:

Code: Select all

Debug PathIsDirectoryEmpty_("c:\") ; Returns 1 if empty.