Re: Launch a doc file with Process.Start(my.doc), need to know when the file is closed.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Paul Clement (UseAdddressAtEndofMessage_at_swspectrum.com)
Date: 12/09/04


Date: Thu, 09 Dec 2004 08:03:48 -0600

On Wed, 8 Dec 2004 10:56:36 -0600, "Tony" <tonyng2@spacecommand.net> wrote:

¤ I'm storing documents and images in a client database.
¤
¤ I want to be able to launch a document or image into the proper application
¤ that can view or modify the object. I do this by copying the object from the
¤ database to the temp directory then calling Process.Start(filename) which
¤ launches the correct application and displays the file - all works great.
¤
¤
¤
¤ My problem now is, I want to know when the application is finished with the
¤ file so I can prompt the user and ask if they want to store the changes (if
¤ any) back in the database (similar to how outlook works when editing an
¤ attachment).
¤
¤
¤
¤ I know I can use SystemFileWatcher to be notified when the file is written
¤ to but that could happen more than once (intermediate saves) while the user
¤ is editing the file. I only want to prompt the user once. It doesn't have an
¤ event to see when the file is closed, just modified, etc.
¤
¤
¤
¤ Also, I need to clean up the temp file when the user is done with it but I
¤ don't know how to detect when the user shuts down the process that is
¤ viewing the file (I don't even know which process is being used or if it's
¤ using a shared process (in the case of Excel) or it's own in the case of
¤ Word, etc.
¤
¤
¤
¤ Does anyone know how to detect when a file is closed or know another way to
¤ deal with this issue?
¤

One thing you can try is handling the Close event from the automation client:

How To Handle Events for Microsoft Word Using Microsoft Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;302816

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)



Relevant Pages

  • Launch a doc file with Process.Start(my.doc), need to know when the file is closed.
    ... I'm storing documents and images in a client database. ... I want to be able to launch a document or image into the proper application ...
    (microsoft.public.dotnet.framework)
  • Re: [PHP] Re: how to display images stored in DB*
    ... Your claim is that in ALL cases using a file system to store images ... bitmaps in a database without a damn good reason, a bad practice, yes. ...
    (php.general)
  • Re: [PHP] Re: how to display images stored in DB**
    ... for storing images is "bad" practice. ... "Bad" practice or "good" practice depends upon the needs and one's perspective of the situation. ... If you were to talk to the average computer user; or to the average investor who invests in technologies; or to the businessman who is paying the bills for programmers to build the product while trying to make money at the same time; they all might have different opinions as to the quality and state of software. ... If you assume that you have one database supply all the images to all ...
    (php.general)
  • Re: bound object frame: picture
    ... Please let me respond to your critique and hopefully help Bob along the way. ... generates can be very large when they contain images. ... Print event NOT THE FORMAT EVENT. ... your entire database will stop working when you get about 100 pictures ...
    (microsoft.public.access.forms)
  • Re: ListView - Caching Thumbnails?
    ... The program just will yield some odd results if they do (which I figure they can deal with if they are monkeying with the database;). ... Access databases fill the middle ground I guess but still, you can edit XML by hand. ... The underlying goal here is to create an interactive anatomical atlas program using high resolution images. ... Then I go back to school ). ...
    (microsoft.public.dotnet.languages.vb)