Solved

Open Document Hook

Posted on 1998-09-11
3
134 Views
Last Modified: 2013-11-20
I are writing a document management system and need to find a way to be notified when a document is about to be opened in a particular directory.  The document could be opened via an Olelink, hyperlink or just double clicking.  It needs to work for any document type (word, excel, txt, etc..)

I've been looking at namespaces, shell extensions, FindFirstChangeNotification and urlmon but haven't found anything yet.  I really don't want to have to write a Vxd to do this.  There has to be another way

Any suggestions you can give would be greatly appreciated.
0
Comment
Question by:therichardsons
[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
  • 2
3 Comments
 
LVL 11

Expert Comment

by:mikeblas
ID: 1322083
Why does there "have" to be another way?  There really isn't.

Simply put, there's no mechanism in Windows to notify other applications of an application's particular decision to perform some arbitrary action. Just think of it: the performance and security implications are enormous.

You can get close to what you want with specific applications that have automation interfaces which might let you query the state of the application.

You won't get what you want with a VXD. The VXD can tell you that a particuar file has been opened by a particular process (see http://www.sysinternals.com/ for samples of such code), but you have no idea _why_ the code opened the file. Maybe it's a backup program doing a backup; maybe it's a user opening the document. Further, you don't know what a file is _for_; it could be code, it could be temporary file, it could be a document.  There's no way to tell with 100% certainty.

You _might_ be able to get someplace with the OLE running object table. If you poll the ROT, you might see that applications you recognize are now running.  Once they're running, you can poll them to see if they're working with a file or object you recognize.

You might also consider writing macros for applications you know about and wish to support; those macros can react when the user decides to open a document and send a monitor program some notification.

But, the bottom line is that certainly isn't "another way" to know what actions an arbitrary application is performing.

B ekiM


0
 

Author Comment

by:therichardsons
ID: 1322084
I think you may have misunderstood the question.  I don't car why the document was opened or who opened it.  I just need to have my app asked if it is OK to open this document.

I have used macros and an OLE embedding model to do this in the past but there are issues with embedding certain documents.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 200 total points
ID: 1322085
Then a VXD is your only viable solution.

B ekiM

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

690 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