Component Object Model and ATL implementation Addendum

Source: Internet
Author: User

Component Object Model and ATL implementation Addendum

Cheungmine

2007-10-11

The component object model and the ATL implementation document have been written, but a key issue is missing. There is another place where you need to modify the atlcom. h file. I will change it here. Open atlcom0.h after correction in the previous article and find the following function:

Stdmethodimp ienumonstlimpl <base, piid, T, copy, colltype >:: next

Correct it to (just change the bold area, in one sentence)

HR = copy: Copy (pelt, & * m_iter );

Change

HR = copy: Copy (pelt, * m_iter );

The complete function after the change is as follows:

Template <class base, const IID * piid, class T, class copy, class colltype>
Stdmethodimp ienumonstlimpl <base, piid, T, copy, colltype >:: next (ulong Celt, T * rgelt,
Ulong * pceltfetched)
{
If (rgelt = NULL | (Celt! = 1 & pceltfetched = NULL ))
Return e_pointer;
If (pceltfetched! = NULL)
* Pceltfetched = 0;
If (m_pcollection = NULL)
Return e_fail;

Ulong nactual = 0;
Hresult hR = s_ OK;
T * pelt = rgelt;
While (succeeded (HR) & m_iter! = M_pcollection-> end () & nactual <CELT)
{
// HR = copy: Copy (pelt, & * m_iter );
HR = copy: Copy (pelt, * m_iter); // cheungmine
If (failed (HR ))
{
While (rgelt <pelt)
Copy: Destroy (rgelt ++ );
Nactual = 0;
}
Else
{
Pelt ++;
M_iter ++;
Nactual ++;
}
}
If (succeeded (HR ))
{
If (pceltfetched)
* Pceltfetched = nactual;
If (nactual <CELT)
HR = s_false;
}
Return hr;
}

 

If you have any questions, refer to my sample code.

Http://download.csdn.net/source/260939

 

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.