There are three methods, from annoyance to ease:
1. directly includeXxx_ I .cFile and import the Type Library. Note that you only need to include it. Do not add it to the project file. compilation will fail.
# Include " Atlexe_ I .c "
# Import " Atlexe. TLB " No_namespace, raw_interfaces_only
Then you can use the guid constants such as clsid_atlexeserver and iid_iatlexeserver.
2. Customize the guid constant and import the Type Library
Const IID iid_iatlexeserver = { 0x2e3c645c , 0x5101 , 0x4a45 , 0x91 , 0x21 , 0x41 , 0xbc , 0x07 , 0x03 , 0x72 , 0x21 } ;
Const CLSID clsid_atlexeserver = { 0x5fd7b054 , 0x472b , 0x4b8a , 0xa7 , 0xe7 , 0x61 , 0x09 , 0x9e , 0x2a , 0xa9 , 0x43 } ;
# Import " Atlexe. TLB " No_namespace, raw_interfaces_only
Copy the guid constant from the midl_define_guid definition section in the xxx_ I .c file. You also need to modify the format by yourself.
3. You can use the type library directly. The Type Library contains the complete definition of guid._ UuidofTo obtain the guid constant.
# Import " Atlexe. TLB " No_namespace, raw_interfaces_only
Iatlexeserver * P = NULL;
Hresult HR = : Cocreateinstance (_ uuidof (atlexeserver ),
Null,
Clsctx_local_server,
_ Uuidof (iatlexeserver ),
( Void ** ) & P );