Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Howto access a enumeration in a COM TypeLib

Reply
Thread Tools

Howto access a enumeration in a COM TypeLib

 
 
Alexander Eisenhuth
Guest
Posts: n/a
 
      06-21-2005
Hello alltogether,

I hope somebody can help me in that case. I bet I have overseen s.th..

I have a VC++ IDispatch Com-Server (ATL) and include for error handling
issues a enumeration in the IDL-File.

[...]
enum PROG_ERROR {
P_OK = 0,
P_ERR_01 = 1,
P_ERR_02 = 2,
...
}
typedef enum PROG_ERROR PROG_ERROR_T;

[...]

I can acess the COM object using :

obj = win32com.client.Dispatch("...")

and can Load the TypeLib:

lib = pythonwin.LoadTypeLib("...")

and see the enumeration in the OLE-Browser of Windows, but don't know
how to access the enum in Python.

Any help and hints are very welcome.

Regards
Alexander

PS.: I use the actual version of ActivePython 2.4.
 
Reply With Quote
 
 
 
 
Konstantin Veretennicov
Guest
Posts: n/a
 
      06-21-2005
On 6/21/05, Alexander Eisenhuth <> wrote:
> Hello alltogether,
>
> I hope somebody can help me in that case. I bet I have overseen s.th..
>
> I have a VC++ IDispatch Com-Server (ATL) and include for error handling
> issues a enumeration in the IDL-File.
>
> [...]
> enum PROG_ERROR {
> P_OK = 0,
> P_ERR_01 = 1,
> P_ERR_02 = 2,
> ...
> }
> typedef enum PROG_ERROR PROG_ERROR_T;
>
> [...]
>
> I can acess the COM object using :
>
> obj = win32com.client.Dispatch("...")
>
> and can Load the TypeLib:
>
> lib = pythonwin.LoadTypeLib("...")
>
> and see the enumeration in the OLE-Browser of Windows, but don't know
> how to access the enum in Python.
>
> Any help and hints are very welcome.
>
> Regards
> Alexander
>
> PS.: I use the actual version of ActivePython 2.4.


Use site-packages/win32com/client/makepy.py to produce myserver.py
from your typelib file, then
>>> import myserver
>>> print myserver.constants. P_OK

0

Maybe you can access constants without makepy, I don't know.

- kv
 
Reply With Quote
 
 
 
 
Alexander Eisenhuth
Guest
Posts: n/a
 
      06-21-2005
Thanks, thats it.

Konstantin Veretennicov schrieb:

>>>>import myserver
>>>>print myserver.constants. P_OK

> 0
>
> Maybe you can access constants without makepy, I don't know.
>
> - kv

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-using a simple type definition; with enumeration constraint andwithout enumeration constraint puvit82 XML 4 02-01-2008 03:46 PM
win32com typelib difficulty Paul McGuire Python 0 05-24-2004 07:56 PM
Call to guid property of Scriptlet.TypeLib times out Thomas Born ASP General 1 02-09-2004 01:55 PM
PBM: MSXML4 typelib constants not recognized in server-side script Vince C. ASP General 12 01-15-2004 06:48 PM
I fought typelib- and typelib won. jwsacksteder@ramprecision.com Python 0 10-28-2003 12:03 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57