Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bind/unbind events to existing instance of Word?
Message
De
03/06/2009 07:59:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01403308
Message ID:
01403360
Vues:
63
>A few months ago Marcia Akins helped me develop a routine to allow users to edit documents created under word automation. It used a form based on BindEvents from her Automation project and restricted the user's ability to Save and Print. For that application, a new instance of Word is opened for editing and then closed when editing is complete. For a different applciation, I'd like to use the open instance of Word (the one used for automation, bind the word events so I can still control Save and Print and then unbind those events when the user is done editing. Is this a crazy idea?
>
>Here's what I have in mind: I pass a reference to Word to the EditDoc form (the document to be edited is already the ActiveDocument.) EditDoc.Init() should bind the Word events (using Marcia's WordWrapper.prg) to the open instance of Word. When the user presses the "Edit" button in EditDoc, Word should be made visible. When the user clicks on the Close box of Word (only sure way I found for them to indicate they are through editing), I'll verify that they are indeed done, and if so, unbind the events and close the EditDoc form. Of course I'm hoping control will return to the line after the call to EditDoc. I doubt it will be that easy but... Is this a crazy idea or are the fundamentals actually workable?
>
>I'd have liked to address this to Marcia but couldn't figure out how--neither name nor ID seems to work in the To: block!

To say my idea honestly, yes it is a crazy idea. If you want to do that anyway, and experience in the future why it is a crazy idea, you can get the object reference with getobject() and then use eventhandler() to bind the events. You can use the code that I posted earlier here on UT (and though I am not sure I also posted that as a reply to your question with samples?). Search for keywords "eventhandler hook word applicationevents2". If you wonder about why it is not a good idea you may also search getobject topics as well.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform