Word Event Hooks

S

S.Vidyaraman

Hello,
This is related to a C# Add-in for MS-Word. I am hooking events on MS Word
so that I can enforce a first level of "permissions" - say prevent copy. How
do I hook the copy "event" ? -- As of now I can capture Ctrl-C and the Menu
Bar -->Edit --> Copy Button click as well as the Standard --> Copy icon
click. But then, this is the button click, not the copy event itself ! How
can I capture an event as opposed to a button click etc ?
Thanks,
S.Vidyaraman
 
C

Cindy M -WordMVP-

Hi S.Vidyaraman,
This is related to a C# Add-in for MS-Word. I am hooking events on MS Word
so that I can enforce a first level of "permissions" - say prevent copy. How
do I hook the copy "event" ? -- As of now I can capture Ctrl-C and the Menu
Bar -->Edit --> Copy Button click as well as the Standard --> Copy icon
click. But then, this is the button click, not the copy event itself ! How
can I capture an event as opposed to a button click etc ?
Unless I'm very mistaken, you're not going to be able to do this with (only)
C#. There are no events triggered by copying or pasting or anything like that.

If we're talking Office 2003, then you could use IRM to set very specific
permissions on what is allowed where in a document. But that's as close as
you're going to get with any current version of Word.

I think *.pdf format (Adobe acrobat) supports not allowing text selection and
copying.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
S

S.Vidyaraman

Hi Cindy,
Thanks for the insight. I saw some DDEPoke functions in the C# library for
MS Word. Are they of any use in trapping events ? Also, how would I trap
copy paste etc events in general? Can I import a dll and hook these events ?
If we're talking Office 2003, then you could use IRM to set very specific
permissions on what is allowed where in a document. But that's as close as
you're going to get with any current version of Word.


As I understand IRM, I need Win 2003 Server to set and create custom
policies. Is there any other alternative ?
Thanks,
S.Vidyaraman
 
C

Cindy M -WordMVP-

Hi S.Vidyaraman,
hanks for the insight. I saw some DDEPoke functions in the C# library for
MS Word. Are they of any use in trapping events ? Also, how would I trap
copy paste etc events in general? Can I import a dll and hook these events ?
No, DDE is really old, old stuff; dates from before events were even part of
the exposed Word OM.

Can't help with "trapping copy and paste events in general" either, although
there might be something in the Windows API that would let you know when the
Clipboard content changes. However, you have to keep in mind that Office now
has its own Clipboard, and I don't think there's ANY programmable interface
for that.

In Word, you have only the possibility to trap the menus, keyboard shortcuts,
toolbars. Generally, if someone asked me how to do this, and they were working
within Word, I'd say: name a procedure EditCopy and it should replace the
built-in command.
As I understand IRM, I need Win 2003 Server to set and create custom
policies. Is there any other alternative ?
And still leave the document editable? Not that I know of. It's very important
to understand that Word was, and remains, a word-processing application. It's
main purpose on this earth is to enable people to edit documents. Preventing
people from doing so runs contrary to the original concept for the program :)
Microsoft has been hearing the need for increased "security" features, but in
order to use them, one has to have the newest technology that supports it.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top