Active X DLL tips?

Roger Roger at see.my.sig
Sun Oct 17 23:54:13 CEST 2004


I want to use and Active X DLL in Python applications. I have the 
win32all stuff installed and the "Excel.Application" example in the 
Client QuickStart section of the manual works OK, so I guess it is 
installed correctly.

Problem comes when I want to use the objects in the OPCDA library. In VB 
I would include the library in the references and could then do 
something like:

Dim foo as OPCServer
dim baa as OPCGroups
(lots of lower level objects omitted)

	set foo=New OPCServer
	foo.Connect <Server details>
	set baa=foo <Call for getting a new OPCGroups object>
	(code continues in a similar manner)

Leading on from the Excel example, I have tried using client.Dispatch 
with "OPCServer", "OPCAutomation.OPCServer" and a few other 
combinations, but I cannot get a valid object. Either I am told the 
string is invalid, or I get no error but the variable which the object 
was supposed to be assigned to is.....not assigned.

Maybe (as warned in the docs) the COM browser is not correctly reporting 
the names I should use. It mentions the VC COM browser, but if you don't 
have that are there other valid alternatives?

I have looked at the gencache functions for generating a Python module 
from the type library, but I am not sure about the parameters, in 
particular, what should the lcid be? Also, what is the correct way to 
pass an IID, as a string complete with the hyphens?

I have looked around for examples but all I have found so far is either 
accessing applications such as Excel, IE and outlook, or building 
clients to test servers that have been created with Python.

I suspect that maybe I sould be doing things a bit differently to access 
a vanilla Automation DLL.

Tips anyone?





More information about the Python-list mailing list