?
Solved

Open Document Hook

Posted on 1998-09-11
3
Medium Priority
?
135 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 400 total points
ID: 1322085
Then a VXD is your only viable solution.

B ekiM

0

Featured Post

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!

Question has a verified solution.

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

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 …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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