win32com support
Crawley
crawley.storm.nospanatallever at ntlworld.com
Thu Jan 29 18:00:16 EST 2004
Im trying to produce a small Visual Studio Addin. Taking the
OutlookAddin example and changing the registry place it installs too,
everything works ok.
Examples in C++ show that in the OnConnection method I have to registry
my commands and also pass an instance of my sub class of ICommands.
The C code looks like this:
IApplication* pApplication = NULL;
pApp->QueryInterface(IID_IApplication, (void**) &pApplication)
CCommandsObj::CreateInstance(&m_pCommands);
m_pCommands->AddRef();
m_pCommands->SetApplicationObject(pApplication);
pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
(LPDISPATCH) m_pCommands, -1, -1, m_dwAddin));
So far Im trying something like this:
self._command = VCCmd(application)
application.SetAddInInfo(AfxGetInstanceHandle(), self._command, -
1, -1, addin )
with VCCmd defined like:
class VCCmd:
_com_interfaces_ = ['_ICommands']
_public_methods_ = []
_application = None
def __init__( self, app ):
self._application = app
print "VCCmd __init__"
Needless to say, its not working, so questions.
1) AfxGetInstanceHandle dosent appear to exist in the win32api... so how
do I call it.
2) am I defining VCCmd correctly to be a subclass of ICommands
3) am I correct in thinking i dont have to explicitly 'cast' application
into an IApplication instance
Many thanks for any light you may be able to shed on the subject
Rich
More information about the Python-list
mailing list