Use the Record Method from win32com.client

object = win32com.client.Dispatch("Server.Object")
IPAddress = win32com.client.Record("IPADDRESS_STRUCT", object)
IPAddress.b1 = 192
IPAddress.b2 = 168
IPAddress.b3 = 0
IPAddress.b4 = 1
object.connect(IPAddress)

        Stefan



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Gijs Korremans
> Sent: Wednesday, May 18, 2005 3:48 PM
> To: python-list@python.org
> Subject: What are com_record objects
> 
> 
> Hi,
> 
> I want to connect to a com object with win32.client.
> Through this com object a have to connect to an other device 
> with object.Connect(struct IPADDRESS_STRUCT * ip)
> 
> the struct IPADDRESS_STRUCT looks like this:
> 
> Byte Offset   Name    Type    Length (Bytes)  Description
> 0     b1      BYTE    1               Byte 1 of an internet address
> 1     b2      BYTE    1               Byte 2 of an internet address
> 2     b3      BYTE    1               Byte 3 of an internet address
> 3     b4      BYTE    1               Byte 4 of an internet address
> 
> Because Python doesn't have structs like C, I tried to do it 
> with a class (C structs are classes with no private) and with 
> pack but I always get the error message "Only com_record 
> objects can be used as records"
> 
> I'm new in the python language but I couldn't find anything 
> about structs or com_records in python on the internet.
> 
> Does anyone know how to do this? 
> 
> Kind regards, 
> 
> 
> Gijs
> 
> --
> This message has been scanned for viruses and
> dangerous content by Network Sentry, and is
> believed to be clean.
> http://www.networksentry.co.za
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to