1. There is no problem under Debug, Release version compile error lnk2001: unresolved external symbol _MAIN Remove _TL_MIN_CRT 2. Release minidependency version of Chinese path problem
Modify the AddString function of StatReg.hcParseBuffer, modify LPSZT for lpszt = charNext (lpszt); 3 .. CCOMBSTR's & (Take Address) Operator does not check if m_str is empty, there is no overloaded & operator, so the following usage CCOMBSTR Or ccomvariant Temp; P-> Method1 (& TEMP); // Use Temp ... P-> Method2 (& Temp); // Using Temp ... is wrong, but the compiler will not issue any warnings, nor As an assertion when running.
4. When the OUT parameter of the method is BSTR, VARIANT or interface pointer, HRESULT MyClass :: Method1 (BSTR | VARIANT | Interface * PVAL) {* pval = m_val; returnid;} The above approach is wrong because OUT parameters The call party is to be released once. Correct and beautiful practice is HRESULT MyClass :: Method1 (BSTR | Variant | Interface * PVAL) {Return M_Val.copyTo (PVAL); // m_val is CCOMBSTR or CCOMPTR or CCOMVARIANT TEMP (M_VAL); // m_val is CCOMVARIANT RETURN TEMP .Detach (pval);
5. The problem mentioned by NT4 is a bug, pvars [0] = & var; dispparams disp = {pvars, null, 1, 0}; pdispatch-> invoke (0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_USER_DEFAULT, DISPATCH_METHOD, & DISP, NULL, NULL, NULL; above is the Fire function generated by the framework, because ccomvariant does not shape the constructor of CCOMVARIANT (Const Variant * PSRC), so pvars [0] = & var call will be CCOMVARIANT (BOOL BSRC), And this may be wrong, so the compiler will warn. As long as it is changed to pvars [0] = var. 6. After installing Platsdk, C2668: 'InlineiseQualguid': Ambiguous Call To overloaded Function Problem
Modify Inlineisequalguid () to :: atl :: inlineisequalguid ()
For details, see http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q243/2/98.asp&nowebcontent=17."com master Heart Sutra "Practice 19 Always initialize [OUT] parameter exit parameters First NULL
XXX :: YYY (ZZZ * PZAAA) {IF (ISBADWRITEPTR (PZAAA)) // IsBadwritePTR 98 does not detect OXCCCCCCC these unin-initial pointers PZAAA {Return E_POINTER;} * pzaaa = null; //. . . . . . . . . }8. Debug To track the number of references in ATL, add the following code line before including ATLBASE.H:
#define _tl_debug_interfaces
This statement causes the "Output" window to display the current reference number of the interface and the corresponding class name and interface name when the AddRef or Release is called each time.
To debug QueryInterface call in ATL, add the following definition before including ATLCOM.H:
#define _tl_debug_qi
Then when debugging, find the name of each interface to the object on the object in the Output window.
Viewer and SPY program allow for viewing objects and events in your computer and memory.
OLE / COM object viewer
OLEVIEW displays the ActiveX and OLE objects installed on your computer as well as their supported interfaces. It also allows editing registry and view type libraries. For more information, see
Use the OLE / COM object viewer.
IdataObject Data Object Viewer
DobjView displays a list of data formats provided by ActiveX and OLE data objects (created by clipboard or drag and drop). See dobjView for more information.
9. AtlinitCommonControls (ICC_COOL_CLASS | ICC_BAR_CLASSES);
If you use the ATL write interface directly, there is no reality such as ListView, please check if it is initialized.
10. Use COM in the thread, you need to initialize COM, :: Coinitialize (NULL)