On the client side, how does one avoid tedious server guid definition and import?

Source: Internet
Author: User
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 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.