On Wednesday, 15 June 2016 at 17:20:31 UTC, John wrote:
On Wednesday, 15 June 2016 at 16:45:39 UTC, Joerg Joergonson wrote:
Thanks. When I ran it I got a d file! when I tried to use that d file I get undefined IID and IDispatch. I imagine these interfaces come from somewhere, probably built in?

Any ideas?

Add the following after the module name:

  import core.sys.windows.com, core.sys.windows.oaidl;

Thanks. Should these not be added to the generated file?

Also, could you add to it the following:

const static GUID iid = Guid!("5DE90358-4D0B-4FA1-BA3E-C91BBA863F32");

inside the interface (Replace the string with the correct guid)?



This allows it to work with ComPtr which looks for the iid inside the interface, shouldn't hurt anything.

In any case, I haven't got ComPtr to work so...


GUID Guid(string str)()
{
static assert(str.length==36, "Guid string must be 36 chars long"); enum GUIDstring = "GUID(0x" ~ str[0..8] ~ ", 0x" ~ str[9..13] ~ ", 0x" ~ str[14..18] ~ ", [0x" ~ str[19..21] ~ ", 0x" ~ str[21..23] ~ ", 0x" ~ str[24..26] ~ ", 0x" ~ str[26..28] ~ ", 0x" ~ str[28..30] ~ ", 0x" ~ str[30..32] ~ ", 0x" ~ str[32..34] ~ ", 0x" ~ str[34..36] ~ "])";
    return mixin(GUIDstring);
}


....

also tried CoCreateInstance and getting error 80040154

Not sure if it works.

....

Changed the GUID to another one found in the registry(not the one at the top of the generated file) and it works. Both load photoshop


int main(string[] argv)
{

        //auto ps = ComPtr!_Application(CLSID_PS).require;
                
//const auto CLSID_PS = Guid!("6DECC242-87EF-11cf-86B4-444553540000"); // PS 90.1 fails because of interface issue const auto CLSID_PS = Guid!("c09f153e-dff7-4eff-a570-af82c1a5a2a8"); // PS 90.0 works.
        


                        
    auto hr = CoInitialize(null);
    auto iid = IID__Application;


    _Application* pUnk;

hr = CoCreateInstance(&CLSID_PS, null, CLSCTX_ALL, &iid, cast(void**)&pUnk);
    if (FAILED(hr))
            throw new Exception("ASDF");

}

The photoshop.d file
http://www.filedropper.com/photoshop_1


So, I guess it works but how to access the methods? The photoshop file looks to have them listed but they are all commented out.

I suppose this is what ComPtr and other methods are used to help create the interface but none seem to work.






Reply via email to