![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Querying for a COM Interface I have come from a C++ background where I have used the following to work with COM CComPtr<IBuilder> builder; builder.CoCreateInstance(__uuidof(Builder)); CComQIPtr<IPersist> loader(builder); I can see how to use new-object -comobject to create the builder object, but how do I go about getting the IPersist interface? Is there a example/tutorial on using COM in Powershell? -- Douglas Woods |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Querying for a COM Interface The Framework's COM interop layer makes a lot of C++-flavored stuff difficult, and PowerShell's additional adaptation tweaks things a bit further, even. Can you clarify more about what you need to do with the IPersist interface? Typically, with the Framework in general and PowerShell in particular, you instantiate the COM object using new-object, and then just access its public methods and properties directly. The actual *COM* interfaces aren't intended to be accessed. For some objects I've been able to use $obj.psbase to access the underlying, unadapted object - what I usually get it the Framework's interop class, though. The Framework doesn't really "like" to surface the hardcore COM I* interfaces that you'd use in C++. -- Don Jones Windows PowerShell MVP Founder: www.ScriptingAnswers.com Co-Author: "Windows PowerShell: TFM" "DouglasWoods" <DouglasWoods@discussions.microsoft.com> wrote in message news:CAE0DCB9-F299-4CD4-B159-74366E6B81FD@microsoft.com... >I have come from a C++ background where I have used the following to work > with COM > > CComPtr<IBuilder> builder; > builder.CoCreateInstance(__uuidof(Builder)); > CComQIPtr<IPersist> loader(builder); > > I can see how to use new-object -comobject to create the builder object, > but > how do I go about getting the IPersist interface? > > Is there a example/tutorial on using COM in Powershell? > -- > Douglas Woods |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Querying for yesterday's events | PowerShell | |||
| Re: querying wmi - recommended structure when iteration seems unnecessary? | VB Script | |||
| Querying a file group on Exchange Server | PowerShell | |||
| Powershell problem in querying some remote Windows 2003 servers | PowerShell | |||
| Querying a number of servers for a specific Event ID -Remote? | PowerShell | |||