Solved

FindFirstChangeNotification

Posted on 1998-08-06
16
797 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi: ForceDirectory plain function 7 49
Tembedded WB animatid gifs not animated on some pcs 2 86
Firemonkey Queue list 1 26
Firemonkey Listview item popup menu ? 1 26
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

740 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