Solved

Open Document Hook

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 48
sameEnds challenge 3 133
sum67 challenge 35 93
withoutTen challenge 14 97
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

943 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

6 Experts available now in Live!

Get 1:1 Help Now