On 15/12/2013 8:28 AM, Jim Bell wrote:
I've been though all the demos and scoured the web, and am stumped. But
I think I'm close. I have a 3rd-party .dll/.tlb. I run makepy.py and it
works fine. I need to pass a callback interface, which they define,
into one of their functions. Here's where I'm stumped.
gencache.EnsureModule('{F8EF...}', 0, 1, 0) # via makepy -i -v
# IID defined in the 3rd-party library...
cbIID = IID('{188....}') # valid IID of ITheirCallBack
# My callback class...
class MyCallBack:
_public_methods_ = [ 'GotMsg' ]
_com_interfaces_ = [ cbIID ] # as defined above
def GotMsg(self, msg):
print 'GotMsg: %s' % str(msg) # Hey!
# This doesn't work: 'Library not registered'
win32com.universal.RegisterInterfaces('{188...}', 0, 1, 0, [
'ITheirCallBack'])
The first param is the UUID of the typelib, not the interface.
# Instantiate my callback...
cbRaw = MyCallBack() # Works fine.
# If I pass cbIID as param 2 here, I get 'No such interface supported'
cbCom = win32com.server.util.wrap(cbRaw)
This will be due to the failing registration above.
HTH,
Mark
cliObj = win32com.client.Dispatch('theirlib.Server.1') # Fine!
# Crux: we make the call,
# but Wireshark shows RemQueryInterface back to us,
# for ITheirCallBack/cbIID,
# and our machine returns E_NOINTERFACE
cliObj.InitServer(cbCom) # Doesn't crash, but fails.
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32