Help needed reading a folders content

Windows specific forum
Large
User
User
Posts: 56
Joined: Tue Apr 29, 2003 8:24 pm

Help needed reading a folders content

Post 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 )
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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)
Large
User
User
Posts: 56
Joined: Tue Apr 29, 2003 8:24 pm

Thanks

Post by Large »

Mmmm, thanks GedB gives me an idea where to start !

Kind regards
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Or, to just see if a directory is empty or not:

Code: Select all

Debug PathIsDirectoryEmpty_("c:\") ; Returns 1 if empty.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply