On Monday, 13 June 2016 at 04:52:49 UTC, Mike Parker wrote:
On Monday, 13 June 2016 at 02:08:22 UTC, Incognito wrote:
What interface are you talking about? How can I cast to
something I don't have? I do not have a photoshop COM
interface. Are you saying that if CoCreateInstance worked that
I can then use the iid or pUnk to access the COM? Do I get the
members by trial and error? pUnk.width? Even if
CoCreateInstance passed, what do I do next?
You have to define the interface yourself, extending from
IUnknown, implementing whatever functions are available on the
COM interface you want. Here's an example for the ID3D11Device
interface:
https://github.com/auroragraphics/directx/blob/master/d3d11.d#L1332
Sorry. Hit send too soon.
Once you've got your interface defined, you should be able to do
this:
MyCOMType mct;
auto hr = CoCreateInstance(&CLSID_DOMDocument60, null,
CLSCTX_ALL, &iid, &cast(void*)mct);
It's been a long time since I worked directly with COM, so there
are probably details I'm missing, but this is the general idea.