473,787 Members | 2,928 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatch er getting Word temp file

My app is creating a word document which my app calls saveas() and saves it
to a given directory that is being watched by a fileSystemWatch er. The
problem is that the fileSystemEvent Handler for creation is only called for
the temporary filed created by word which shows up as ~$documentName. doc the
real file named MyDocument.doc will never invoke the fileSystemEvent Handler
for creation. Now when the user closes Word the temporary file is deleted
and my app only had a handle to that file.
How come I am not getting any notification about the creation of the real
file even though it was saved using saveas() and I do see it created in
windows explorer?
Jul 21 '05 #1
3 6267
On Mon, 18 Oct 2004 11:20:56 -0400, zfeld wrote:
My app is creating a word document which my app calls saveas() and saves it
to a given directory that is being watched by a fileSystemWatch er. The
problem is that the fileSystemEvent Handler for creation is only called for
the temporary filed created by word which shows up as ~$documentName. doc the
real file named MyDocument.doc will never invoke the fileSystemEvent Handler
for creation. Now when the user closes Word the temporary file is deleted
and my app only had a handle to that file.
How come I am not getting any notification about the creation of the real
file even though it was saved using saveas() and I do see it created in
windows explorer?


Off the top of my head, I would say that the temp file is being created and
then renamed to the final filename. When a file is renamed, a create is
not fired for the new name. Try setting up your FileSystemWatch er to
handle the rename event.

--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Jul 21 '05 #2
Thanks,

What I discovered is that the temporary ~$documentName. doc never gets
renamed, it is just deleted on close. However another file is created at the
same time as the ~$documentName. doc that doesn't even have the .doc
extension, which was why I wasn't seeing it, it is usually something like
wrd005.tmp this then gets subsequently renamed into MyDocument.doc. I
therefore had to ignore the creates of .doc files that start with ~ and
catch renames from a .tmp extension to .doc extensions.
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcg lobal[dot]]net"> wrote in
message news:1m******** *************** *******@40tude. net...
On Mon, 18 Oct 2004 11:20:56 -0400, zfeld wrote:
My app is creating a word document which my app calls saveas() and saves
it
to a given directory that is being watched by a fileSystemWatch er. The
problem is that the fileSystemEvent Handler for creation is only called
for
the temporary filed created by word which shows up as ~$documentName. doc
the
real file named MyDocument.doc will never invoke the
fileSystemEvent Handler
for creation. Now when the user closes Word the temporary file is deleted
and my app only had a handle to that file.
How come I am not getting any notification about the creation of the real
file even though it was saved using saveas() and I do see it created in
windows explorer?


Off the top of my head, I would say that the temp file is being created
and
then renamed to the final filename. When a file is renamed, a create is
not fired for the new name. Try setting up your FileSystemWatch er to
handle the rename event.

--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Jul 21 '05 #3
in the onchanged event handler use the following code
if file.getextensi on(e.fullpath). substring(0,1)< >"~" then
write ur code here
end if

regards
soni

"zfeld" wrote:
My app is creating a word document which my app calls saveas() and saves it
to a given directory that is being watched by a fileSystemWatch er. The
problem is that the fileSystemEvent Handler for creation is only called for
the temporary filed created by word which shows up as ~$documentName. doc the
real file named MyDocument.doc will never invoke the fileSystemEvent Handler
for creation. Now when the user closes Word the temporary file is deleted
and my app only had a handle to that file.
How come I am not getting any notification about the creation of the real
file even though it was saved using saveas() and I do see it created in
windows explorer?

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
9755
by: Jon Maz | last post by:
Hi there, I am experimenting with the FileSystemWatcher object. I have set the NotifyFilter as follows: myFileSystemWatcher.NotifyFilter = NotifyFilters.Security | NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.Attributes |
1
5175
by: TD | last post by:
I'm watching a folder for new files. When the files arrive, I want to wait until it is done being written to and then move it. Every time I move a file into the test folder, it triggers 3 calls to the OnChanged handler. I can't tell what is changing between the 2nd and 3rd call to know whether it is safe to move the file yet? If I was certain it was always 3, I could go then but I'm not sure that it will always be 3 calls.
13
9181
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just multiple directories. I have hit a snag and don't know how to get around it. Basically I read in a list of directories from the app.config and stuff them into an array, so that I have something like this: sDirsToWatch = "C:\Temp"
3
4603
by: Stampede | last post by:
Hi, I write an application which waits for incomming files in a specified directory. I thought, that using the FileSystemWatcher would be the best, as it does exactly what I need. But now I have a problem: I wonna get shure, that really all files are processed and I need to be shure, that no file is processed twice. If my application is started while there are already files in the directory (which is realistic, as the application could...
3
367
by: zfeld | last post by:
My app is creating a word document which my app calls saveas() and saves it to a given directory that is being watched by a fileSystemWatcher. The problem is that the fileSystemEventHandler for creation is only called for the temporary filed created by word which shows up as ~$documentName.doc the real file named MyDocument.doc will never invoke the fileSystemEventHandler for creation. Now when the user closes Word the temporary file is...
1
10451
by: Abel Chan | last post by:
Hi there, I was trying to write a simple NT services using .NET 2.0 and fileSystemWatcher control. The goal is to poll documents from a watch directory and ftp them to a remote web site. I created a Windows Services project using VS2005. Drag a fileSystemWatcher control to the designer and added the following code. Here is what I found out when I create a new file under the watch directory: 1) Using notepad - OnCreate event...
12
7462
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
2
2408
by: piola vago | last post by:
I'm making an application that monitor a particular file (not a directoy) and when trigger a change event it start a backup process of the changed file. I'm using FileSystemWatcher component. My problem is that i cannot start the backup process until the word file is closed. I think this is caused because Word application saves changes in a temporary file, and the changes are mapped to the REAL file only after closing de Word application,...
1
3160
by: Lila Godel | last post by:
My VB.NET 2008 application is setup with a Sub Main and no forms. At run time a NotifyIcon is created with one context menu choice (Close which terminates app). I have no trouble running the application and when I select Close from the icon's right click menu the system tray icon goes away and the application is removed from the listing on the processes tab of task manager. My problem is that the FileSystemWatcher event does not work....
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.