com - How would one instantiate a class given a ProgID alone in C++? -


say have progid prog.class. in powershell, enough things

$obj = new-object -com "prog.class" $obj.method(); 

in c++ though, need know supported interfaces

cocreateinstance(clsidfromprogid(...),...,iid_someinterface,...) 

how away in c++ knowing progid , not interface ids? there way possible interface ids? can cocallmethodonclass(...)?

powershell uses iid_idispatch obtain idispatch*. interface supports late binding, many com servers implement it.

c++ not support late binding in language syntax, make more painful affair. you'll have call idispatch::getidsofnames() translate member name "method" dispid, idispatch::invoke() call it.


Comments

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -