Masaki Suketa
12/9/2005 9:01:00 AM
Hello,
In message "Re: Win32OLE: Output parameters, Dispatch IDs"
on 05/12/09, "Dave Burt" <dave@burt.id.au> writes:
> You're welcome. I actually emailed the start of this thread directly to the
> Win32OLE maintainer in hope he can enlighten us - he has sometimes taken a
> bit of time to get around to responding, so let's be patient on that front.
Sorry for being too late to reply.
> # Get a Win32_Process WMI object
> wmi_svc = WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2:Win32_Process")
> # Try to get the method
> wmi_svc.ole_method("Create") #=> WIN32OLERuntimeError: Not found Create
> # Invoke the method
> wmi_svc.invoke("Create", "notepad", nil, nil, nil) #=> (Creates notepad.exe process)
(snip)
> Is there a way I can get info on a method like that, and how do I get the result
> of an output parameter?
You can get the result of an output parameter using WIN32OLE::ARGV.
wmi_svc = WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2:Win32_Process")
wmi_svc.invoke("Create", "notepad", nil, nil, nil)
p WIN32OLE::ARGV # => ["notepad", -2147352572, -2147352572, 1704]
I am going to investigate why ole_method is failed.
Please wait for a while.
Regards,
Masaki Suketa