This question is in continuation to my previous question.
I am trying to get Network Statistics for my Windows 7 system using PyWin32.
The steps I followed:
1) Run
COM MakePy utilityand than selectnetwork list manager 1.0 type libraryunder type library.2) Above process generated this python file.
Next I created the object of class NetworkListManager(CoClassBaseClass) using
import win32com.client as wc
obj = wc.Dispatch("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")
Now I am trying to access the methods provided by the above created object obj.
help(obj) gave me
GetNetwork(self, gdNetworkId= <PyOleEmpty object>)
Get a network given a Network ID.
IsConnected
Returns whether connected to internet or not
//Other methods removed
So, now when I use
>>> obj.IsConnected
True
It works fine.
Now the problem I am facing is how to use GetNetowrk method because when I try to use it
>>> obj.GetNetwork()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ret = self._oleobj_.InvokeTypes(2, LCID, 1, (9, 0), ((36, 1),),gdNetworkId
com_error: (-2147024809, 'The parameter is incorrect.', None, None)
I also tried creating PyOleEmpty object by using pythoncom.Empty and passed it as a paremeter but no luck.
I understand GetNetwork require NetworkID as a parameter but the method GetNetworkId is defined in INetwork class.
So my question is how to use classes defined in the python file created using MakePy utility which are not CoClass.