Thanks Mark. I'll dig around the various windows typelilbs and see if one of
them has a GUID structure.

If I know the order of the structure myself (and know how to turn in to a
buffer) does anyone know how I could convert the buffer in to a com_record ?

On Feb 1, 2008 12:34 AM, Mark Hammond <[EMAIL PROTECTED]> wrote:

>  The record will be defined in a typelib somewhere, and have named
> elements.  For example, the win32com test VB code:
>
>
>
> Public Type VBStruct
>
>     int_val As Integer
>
>     str_val As String
>
>     ob_val As Object
>
>     sub_val As SubStruct
>
> End Type
>
>
>
> And VB arranges for that to become a COM record.  Python code can then
> say:
>
>
>
>     s = win32com.client.Record("VBStruct", vbtest)
>
>     s.int_val = -1
>
>
>
> (Where vbtest in the first line is a COM object that comes from the same
> typelib which defines the struct).  The object 's' can then be passed as a
> param, where it will become VT_RECORD.  Without knowing how the struct is
> defined in your case I can't speculate how a GUID would be carried.  If it
> was a simply array of bytes, then using 'buffer(guid)' will give you the raw
> bytes.
>
>
>
> Cheers,
>
>
>
> Mark
>
>
>
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Kevin Patterson
> *Sent:* Friday, 1 February 2008 2:34 PM
> *To:* python-win32@python.org
> *Subject:* [python-win32] How to create a com_record?
>
>
>
> I have a COM server that is expecting a GUID as an argument. The generated
> makepy shows that the function is expecting a VT_RECORD. I cannot seem to
> pass in the CLSID, I get the following:
>
> TypeError: Only com_record objects can be used as records
>
> I looked at the win32com.client.Record function, but it looks like it will
> create another COM object if I give it the GUID.What I really need is to
> pass the GUID in to this function as a sort of structure.  I "think" I have
> to build a struct (using the struct class?) turn it into a buffer and then
> somehow convert this to a Record object....Trouble is I can't find any
> documentation on com_record objects anywhere....Any ideas?
>
> Thanks,
> Kevin
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to