Solved

Open Document Hook

Posted on 1998-09-11
3
128 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 166
Perl Awk Need Help 3 94
substring method in java 1 79
Line meaning 9 77
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now