<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>Hi, <BR><BR> To develop a interface to a COM library under
Boa Constructor and WxPython, Python 2.5, I had to use the makepy utility to
generate the classes file.<BR><BR> I show you a part of this
file:<BR></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>class
_IPmacDeviceEvents:<BR> """_IPmacDeviceEvents Interface"""<BR> CLSID =
CLSID_Sink =
IID('{D1C5C7C8-5E0C-495E-9AAF-85B146DA5F13}')<BR> coclass_clsid =
IID('{B544D2BD-354C-456E-9E88-20F71625E7DF}')<BR> _public_methods_ = [] #
For COM Server support<BR> _dispid_to_func_ =
{<BR> 5 :
"OnUnsolicited",<BR> 3 :
"OnError",<BR> 4 :
"OnInterrupt",<BR> 2 :
"OnProgress",<BR> 1 :
"OnMessage",<BR> 6 :
"OnDataReady",<BR> }</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial><FONT size=2> def __init__(self, oobj =
None):<BR> if oobj is None:<BR> self._olecp =
None<BR> else:<BR> import
win32com.server.util<BR> from win32com.server.policy import
EventHandlerPolicy<BR> cpc=oobj._oleobj_.QueryInterface(pythoncom.IID_IConnectionPointContainer)<BR> cp=cpc.FindConnectionPoint(self.CLSID_Sink)<BR> cookie=cp.Advise(win32com.server.util.wrap(self,
usePolicy=EventHandlerPolicy))<BR> self._olecp,self._olecp_cookie
= cp,cookie<BR> def
__del__(self):<BR> try:<BR> self.close()<BR> except
pythoncom.com_error:<BR> pass<BR> def
close(self):<BR> if self._olecp is not
None:<BR> cp,cookie,self._olecp,self._olecp_cookie =
self._olecp,self._olecp_cookie,None,None<BR> cp.Unadvise(cookie)<BR> def
_query_interface_(self, iid):<BR> import
win32com.server.util<BR> if iid==self.CLSID_Sink: return
win32com.server.util.wrap(self)</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial><FONT size=2> # Event Handlers<BR> # If you
create handlers, they should have the following prototypes:<BR># def
OnUnsolicited(self, Device=defaultNamedNotOptArg,
Msg=defaultNamedNotOptArg):<BR># """method
Unsolicited"""<BR># def OnError(self, Device=defaultNamedNotOptArg,
FileName=defaultNamedNotOptArg, ErrorID=defaultNamedNotOptArg,
LineNum=defaultNamedNotOptArg<BR># ,
Line=defaultNamedNotOptArg):<BR># """method Error"""<BR># def
OnInterrupt(self, Device=defaultNamedNotOptArg,
lLevel=defaultNamedNotOptArg):<BR># """method
Interrupt"""<BR># def OnProgress(self, Device=defaultNamedNotOptArg,
dwPercent=defaultNamedNotOptArg):<BR># """method
Progress"""<BR># def OnMessage(self, Device=defaultNamedNotOptArg,
Msg=defaultNamedNotOptArg,
bNewLine=defaultNamedNotOptArg):<BR># """method
Message"""<BR># def OnDataReady(self,
Device=defaultNamedNotOptArg):<BR># """method
DataReady"""</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>;</FONT></DIV>
<DIV><FONT face=Arial size=2>;</FONT></DIV>
<DIV><FONT face=Arial size=2>;</FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>from win32com.client import
CoClassBaseClass<BR># This CoClass is known by the name
'PcommServer.PmacDevice.1'<BR>class PmacDevice(CoClassBaseClass): # A
CoClass<BR> # PmacDevice Class<BR> CLSID =
IID('{B544D2BD-354C-456E-9E88-20F71625E7DF}')<BR> coclass_sources = [<BR>
_IPmacDeviceEvents,<BR> ]<BR> default_source = _IPmacDeviceEvents<BR>
coclass_interfaces = [<BR> IPmacDevice,<BR> ]<BR> default_interface =
IPmacDevice<BR><BR></FONT>I can call PmacDevice() class without problem and
everything works well to communicate with the card. </FONT></DIV>
<DIV><FONT face=Arial>How to use the events managed in the library
?<BR><BR> Do you have a example or tutorial ?<BR><BR> Thanks a lot.<BR><BR>
Serge Gauthier<BR></DIV></FONT><!-- SPAMfighter Signature --><br><hr>J'utilise la version gratuite de SPAMfighter pour utilisateurs privés.<br />1939 e-mails spam ont été bloqués jusqu'à maintenant.<br /> Les utilisateurs payant n'ont pas ce message dans leurs e-mails.<br />Essayez <a href="http://www.spamfighter.com/lfr">SPAMfighter</a> gratuitement maintenant!<br /></BODY></HTML>