Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Capture com events

Reply
 
Old 06-27-2006   #1 (permalink)
Greg Borota


 
 

Capture com events

I am working on controlling InternetExplorer object and some Microsoft Office
objects. But I need to capture the events they generate.

By doing:

PS C:\> $a=New-Object -COM InternetExplorer.Application;
PS C:\> $a.Navigate2("www.microsoft.com"); $a.visible=$true
PS C:\> $a | get-member

I can see there is no method to let me get to COM events generated by
InternetExplorer.Application

But if I do:

PS C:\> $a=New-Object -COM Word.Application; $a.visible=$true
PS C:\> $a | get-member | more

I get things like:
add_DocumentBeforeClose
add_DocumentBeforePrint …………..

Evidently I can implement handlers for the events generated by
Word.Application.

The difference seems to be in the fact that later version of Microsoft
Office come bundled with Primary Interop Assemblies (PIAs). But there is no
PIA for Internet Explorer. Luckily we can generate Interop Assemblies
ourselves by using tlbimp.exe or .NET libraries.

My question is: isn’t there a simpler way? Something like WHS
CreateObject(obj, eventPrefix), etc.? Any plans to have that in the future?

Greg

P.S. A quick fix solution for InternetExplorer object could be to have its
PIAs distributed with PowerShell, but I guess there are security concerns
with that. By the way, is there a place where one could find PIAs for
Internet Explorer?


My System SpecsSystem Spec
Old 06-28-2006   #2 (permalink)
Greg Borota


 
 

Re: Capture com events

As I can see, no body 'touched' this message.
I wonder, if you need reliable COM handling, going back to C++/VB is the
only head-ache free solution?

Greg

"Greg Borota" <Greg Borota@discussions.microsoft.com> wrote in message
news:1734CF6A-8925-477B-BDAE-3E1A779D4622@microsoft.com...
>I am working on controlling InternetExplorer object and some Microsoft
>Office
> objects. But I need to capture the events they generate.
>
> By doing:
>
> PS C:\> $a=New-Object -COM InternetExplorer.Application;
> PS C:\> $a.Navigate2("www.microsoft.com"); $a.visible=$true
> PS C:\> $a | get-member
>
> I can see there is no method to let me get to COM events generated by
> InternetExplorer.Application
>
> But if I do:
>
> PS C:\> $a=New-Object -COM Word.Application; $a.visible=$true
> PS C:\> $a | get-member | more
>
> I get things like:
> add_DocumentBeforeClose
> add_DocumentBeforePrint ......
>
> Evidently I can implement handlers for the events generated by
> Word.Application.
>
> The difference seems to be in the fact that later version of Microsoft
> Office come bundled with Primary Interop Assemblies (PIAs). But there is
> no
> PIA for Internet Explorer. Luckily we can generate Interop Assemblies
> ourselves by using tlbimp.exe or .NET libraries.
>
> My question is: isn't there a simpler way? Something like WHS
> CreateObject(obj, eventPrefix), etc.? Any plans to have that in the
> future?
>
> Greg
>
> P.S. A quick fix solution for InternetExplorer object could be to have its
> PIAs distributed with PowerShell, but I guess there are security concerns
> with that. By the way, is there a place where one could find PIAs for
> Internet Explorer?
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can vbscript capture Word.Application events ? VB Script
How can you capture individual thumbnails not full capture ? Vista music pictures video
Wmi events PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46