[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

RxFolderMonitor?

Posted on 1998-08-24
14
Medium Priority
?
719 Views
Last Modified: 2008-02-01
Hi,

 This may be stupid, but has anybody tried to use the RxFolderMonitor already? And did it work?
Can somebody give me a working example? Or is it so that the notify mechanism doesn't work on an Windows NT platform???

Regards, Zif.
0
Comment
Question by:ZifNab
[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
  • 8
  • 5
14 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1337481
Hi Zif,
Just tried it (on NT4) and I can't seem to get it to work either.
Are you using D4?

/// John
0
 
LVL 8

Author Comment

by:ZifNab
ID: 1337482
John,
 No, I've got D3 :-(

Zif.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1337483
ZifNab,

a few weeks ago I got it to work (with Delphi 3). Now I've Delphi 4 installed and it doesn't work anymore. But it is "only" an object implemenation of "FindFirstChangeNotification". You can do this with the windows API instead. But "FindFirstChangeNotification" is very stupid. It only tells you that something has happened in the folder it is watching at, not WHAT has changed...   :-(

Regards, Madshi.
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: 1337484
If you're using NT only, you should look at "ReadDirectoryChangesW" instead. I didn't work with it yet but it looks interesting...

Madshi.
0
 
LVL 8

Author Comment

by:ZifNab
ID: 1337485
Madshi,
 to bad, it has to work on 95.. too... How did you get it to work?
Zif.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1337486
ZifNab,

I tried again, now I got it to work. I did the following:

(1) Create a new application.
(2) Add a RxFolderMonitor component to "Form1".
(3) Set FolderName to "C:\".
(4) Set MonitorSubtree to "false".
(4) Set Active to "true".
(5) Create an event handler with nothing but a "beep" in it.
(6) Save and run application.
(7) Create a new dummy folder "C:\new folder".
(8) Now it beeps...   :-)

Hope it works with Delphi 3, too.

Regards, Madshi.
0
 
LVL 8

Author Comment

by:ZifNab
ID: 1337487
mmm, no beep here (message 'hello'). :-(
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1337488
That's strange. Did you test it with Win95, too?
0
 
LVL 8

Author Comment

by:ZifNab
ID: 1337489
madshi, no only Win NT (=work) at the moment.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1337490
ZifNab,

I've neither WinNT nor Delphi3 to test it in the moment. Please try it at home with Win95 and then write a comment again...
Or wait until next monday. Then I can test it with WinNT.

Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1337491
ZifNab,

I've checked it with WinNT: it seems that it really doesn't work! So my suggestion: Call API instead of using Rx...

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, tools;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen}
  public
    { Public-Deklarationen}
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

var notifyHandle : cardinal;

function NotifyThreadProc(dummy: pointer) : cardinal; stdcall;
begin
  result:=0;
  repeat
    WaitForSingleObject(notifyHandle,INFINITE);
    beep;
    SetForegroundWindow(Application.handle);
    MessageBox(Application.handle,'Something has changed...','Information',0);
  until not FindNextChangeNotification(notifyHandle);
end;

procedure TForm1.Button1Click(Sender: TObject);
var tid : cardinal;
begin
  notifyHandle:=FindFirstChangeNotification('C:\',false,FILE_NOTIFY_CHANGE_FILE_NAME or
                                                        FILE_NOTIFY_CHANGE_DIR_NAME  or
                                                        FILE_NOTIFY_CHANGE_ATTRIBUTES);
  if notifyHandle<>INVALID_HANDLE_VALUE then begin
    CloseHandle(CreateThread(nil,0,@notifyThreadProc,nil,0,tid)); // Don't like Delphi threads...
  end else begin
    beep;
    MessageBox(0,'FindFirstChangeNotification could not be installed...','Information',0);
  end;
end;

end.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1337492
P.S: Look at http://www.experts-exchange.com/Q.10077312.
There you'll find a little object example, too.
0
 
LVL 8

Author Comment

by:ZifNab
ID: 1337493
Madshi,

call it as an answer, and I grade you after my vacation! Help me not forgetting it!

Regards, Zif.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 1337494
Thanx, Zif...   :-)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

649 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