COM, IDL, and enum

O

Olaf Meding

How do I access the values of the enum "ERLockStatus" specified in the
(abreviated IDL) file below?

This code works fine and lets me call the methods of the user
interface.
import win32com.client
ui = win32com.client.Dispatch('ERFile.User')
ui.someMethod()


Here is the (abreviated) IDL file:
// This file will be processed by the MIDL tool to
// produce the type library (ERFile.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

[
uuid(bf79b6c5-47be-11d2-bacd-006008060a3a),
version(1.0),
helpstring("ERFile 1.0 Type Library")
]
library ERFile
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");

[
object,
uuid(bf79b6c7-47be-11d2-bacd-006008060a3a),
dual,
helpstring("IERecord Interface"),
pointer_default(unique),
nonextensible,
hidden
]
interface IUser : IDispatch { code deleted here };


[helpstring("ER Lock Status")]
enum ERLockStatus {
ls_unlocked, ls_by_caller, ls_by_another, ls_not_locked
};

more code deleted here

};


Thanks much in advance for your help.

Olaf
 
M

Mark Hammond

Olaf said:
How do I access the values of the enum "ERLockStatus" specified in the
(abreviated IDL) file below?

You must ensure that makepy has been run for your object - this
generally just means calling gencache.EnsureDispatch() to create your
object. Once the makepy'd file for the IDL has been loaded, the
constants will be available as "win32com.client.constants.constant_name"

Mark
 

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,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top