#include <iostream>
//#include <comutil.h> //头文件一定是下面的这个,否则会出现错误
#include <comdef.h>
using namespace std;
class _TestTrace
{
_bstr_t m_bstrName;
public:
_TestTrace(_bstr_t bstrName):m_bstrName(bstrName)
{
cout << "****** begin: " << (LPCTSTR)m_bstrName << "******" << endl;
}
~_TestTrace()
{
cout << "****** end: " << (LPCTSTR)m_bstrName << " ******" << endl;
}
};
#ifndef _TT
#define _TT _TestTrace _tt(__FUNCTION__);
#endif
void myfunction()
{
_TT;
cout << "function" << endl;
}
int main()
{
myfunction();
return 0;
}