re[2]: Com object questions

G

Gijs Korremans

Does IPADDRESSSTRUCT appear anywhere in the makepy-generated module ?
Specifically, there should be a RecordMap dict containing any defined
Records
and their GUID's.

No it's not in the genereted module, but it is in the COM Browser so I'm sure the struct is in the com object
Maybe I can find out somewhere what the GUID's is and put it in the RecodMap manually?

Roger

Hi,

I'm still figuring out how I can use the win32com for the use of a com
object which I think is made in VB

First I've created a file with MakePy
Then I used the following code to init the com object:
import win32com.client
Client = win32com.client.Dispatch("ClientModule.Client")

Then, when I want to use a function, for example this one:
ipaddr = kddClient.GetLocalIPAddress()
I get this error:
File
"C:\Python23\lib\site-packages\win32com\gen_py\0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0.py",
line 69, in GetLocalIPAddress
return self._ApplyTypes_(11, 1, (36, 0), (), 'GetLocalIPAddress', None,)
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 446,
in _ApplyTypes_
return self._get_good_object_(self._oleobj_.InvokeTypes(dispid, 0,
wFlags, retType, argTypes, *args),user, resultCLSID)
com_error: (-2147024809, 'The parameter is incorrect.', None, None)
I don't know which parameter is incorrect because the function doesn't need
any parameters

and when I try to use a struct for the IP address using the following code:
ipaddr = win32com.client.Record("IPADDRESS_STRUCT", Client)
I get this message:
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 403,
in Record
raise ValueError, "The structure '%s' is not defined in module '%s'" %
(name, package)
ValueError: The structure 'IPADDRESS_STRUCT' is not defined in module
'<module 'win32com.gen_py.0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0' from
'C:\Python23\lib\site-packages\win32com\gen_py\0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0.pyc'>'
I think this means that there is no struct IPADDRESS_STRUCT defined in the
com object but when I'm going to the ComBrowser in PythonWin it is in there.

I'm using python 2.3 with pywin32 build 203

Does anybody know what i'm doing wrong?

Kind regards,


Gijs <



Kind regards,


Gijs
 
R

Roger Upole

I took a look at the code that generates the Record info, and it doesn't
handle
records that don't have a guid (or more accurately, the guid is GUID_NULL).
They're still supposed to show up in the generated module with a comment
stating that they weren't handled. However, it's trying to keep them in a
dict
with guid as the key, and when you have several with GUID_NULL only the
last one ever shows up. Best guess is that this particular record is one of
the
ones getting zapped accidently.

Looks like it should be possible to create a python record object from
just the
name by getting the type info from the typelib and passing it to
GetRecordInfoFromTypeInfo. Unfortunately, that function isn't wrapped by
pythoncom yet. You might want to file a feature request with the Pywin32
project.

Roger



Does IPADDRESSSTRUCT appear anywhere in the makepy-generated module ?
Specifically, there should be a RecordMap dict containing any defined
Records
and their GUID's.

No it's not in the genereted module, but it is in the COM Browser so I'm
sure the struct is in the com object
Maybe I can find out somewhere what the GUID's is and put it in the RecodMap
manually?

Roger

Hi,

I'm still figuring out how I can use the win32com for the use of a com
object which I think is made in VB

First I've created a file with MakePy
Then I used the following code to init the com object:
import win32com.client
Client = win32com.client.Dispatch("ClientModule.Client")

Then, when I want to use a function, for example this one:
ipaddr = kddClient.GetLocalIPAddress()
I get this error:
File
"C:\Python23\lib\site-packages\win32com\gen_py\0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0.py",
line 69, in GetLocalIPAddress
return self._ApplyTypes_(11, 1, (36, 0), (), 'GetLocalIPAddress', None,)
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 446,
in _ApplyTypes_
return self._get_good_object_(self._oleobj_.InvokeTypes(dispid, 0,
wFlags, retType, argTypes, *args),user, resultCLSID)
com_error: (-2147024809, 'The parameter is incorrect.', None, None)
I don't know which parameter is incorrect because the function doesn't need
any parameters

and when I try to use a struct for the IP address using the following code:
ipaddr = win32com.client.Record("IPADDRESS_STRUCT", Client)
I get this message:
File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 403,
in Record
raise ValueError, "The structure '%s' is not defined in module '%s'" %
(name, package)
ValueError: The structure 'IPADDRESS_STRUCT' is not defined in module
'<module 'win32com.gen_py.0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0' from
'C:\Python23\lib\site-packages\win32com\gen_py\0F4570B8-4D39-47CD-84B4-8A424233EEBFx0x1x0.pyc'>'
I think this means that there is no struct IPADDRESS_STRUCT defined in the
com object but when I'm going to the ComBrowser in PythonWin it is in there.

I'm using python 2.3 with pywin32 build 203

Does anybody know what i'm doing wrong?

Kind regards,


Gijs <



Kind regards,


Gijs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top