473,772 Members | 3,148 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 6266
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
5174
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
9180
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
4602
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
10448
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
7460
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
2407
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
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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
10104
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...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9912
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
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.