Solved

FindFirstChangeNotification

Posted on 1998-08-06
16
791 Views
Last Modified: 2008-02-01
i am using FindFirstChangeNotification / FindNextChangeNotification in a thread and it works fine.
What reports is only that something has changed in the defined directory or below.

I need to know in which subdir. the change was.
How can i use the handle (h) to find details?

path := stralloc(64);
path := 'c:\temp\';
h := FindFirstChangeNotification(path, BOOL(1), FILE_NOTIFY_CHANGE_FILE_NAME OR FILE_NOTIFY_CHANGE_DIR_NAME);
0
Comment
Question by:kyr
  • 6
  • 5
  • 2
  • +3
16 Comments
 

Expert Comment

by:kashif063098
ID: 1361636
hi
you can use Win32 api GetFileInformationByHandle() to get additional info of directory or file


0
 

Expert Comment

by:kashif063098
ID: 1361637
if you example,please let me know

0
 

Author Comment

by:kyr
ID: 1361638
are you sure?
Does GetFileInformationByHandle work with the handle that
FindFirstChangeNotification returns?

I couldn't make it work...
Actually this handle is a handle to a find change notification object.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 20

Expert Comment

by:Madshi
ID: 1361639
As far as I know, FindFirstChangeNotification is just stupid. You can't get further infos from your handle.  :-(
But I'm not so absolutely sure...
We solved this problem with a vxd driver. You can find a vxd sample "FileMonitor" on "www.sysinternals.com". It's just what you need. But I don't know if you really want to work with drivers. If you want, you'll need the example (see above) and Microsoft or Borland C compiler and vireo's vToolsD.
Sorry!
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1361640
Use ReadDirectoryChangesW instead

This gives you access to a structure called FILE_NOTIFY_INFORMATION which contains the name of the file and the operation performed.


0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361641
Works only with WinNT, I suppose...  :-(
0
 

Expert Comment

by:JimmyWhite
ID: 1361642
hi,

Look at Torry's Delphi Pages in the section vcl, files and drives or something like that and you will find 3 or 4 components with source which will do exactly what you want.
The best are : dirchange and dirmon.
0
 

Author Comment

by:kyr
ID: 1361643
Answers2000:
It is only for NT sorry... i cannot accept it. I cannot ever give it a try

JimmyWhite:
This is not what i am looking for.
The first one only tells you a change has occured, while the other one only monitors the current level of the giver directory, not its subs.

QUESTION TURNS TO:
what i found best is to try to connect to filevxd.vxf from filemon at www.sysinternals.com, and do the rest.
But i cannot convert the c code to obj.pascal (source code from site above).
I would appreciate any help to do this
(increased points to 150-tell me for more.)

0
 

Author Comment

by:kyr
ID: 1361644
Adjusted points to 150
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361645
I'm not sure. Do you want to
(1) build the driver itself in Delphi or
(2) use vireo's driver and communicate with it in Delphi?
As far as I know (1) does not work at all. (2) should be possible, but where is your problem? Don't you understand C(++)? If so, I cannot help you, because I don't have the time to do the whole work for you. But if there are only some specific problems, tell me details...

Regards, Madshi.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1361646
0
 

Author Comment

by:kyr
ID: 1361647
ronit: they say nothing of great interest.
it is not that you/they cannot help.

i understand i am using the wrong approach.

the sysinternals vxd driver is abslutely the best solution.

Dear Madshi,
  -can i freely use the driver with a project currently developing?
  -i finally managed to connect to it from delphi and it works perfectly.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1361648
kyr,

that's a good question. I don't know that either, because we built our own driver and only looked at the sysinternals sources. Please write to "cogswell@winternals.com". He will answer your question.

Regards, Madshi.
0
 

Author Comment

by:kyr
ID: 1361649
i am giving you the points Madshi!
please propose it as answer.
question is closed.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 150 total points
ID: 1361650
Thanks, kyr...   :-)
0
 

Author Comment

by:kyr
ID: 1361651
thanks too...

cu
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question