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
Post a Comment