That's it! If you don't want to use C++ attributes, there are corresponding classes and macros
that you can use instead. You should also be aware that setting counters to specific values is
generally safe without having to worry about thread synchronization, but performing calculations
on the counters, such as incrementing or decrementing, requires the use of atomic operations
such as InterlockedIncrement or synchronization using critical sections.
能否在ATL中使用CString,或者在大型的MFC中使用ATL实现COM对象?哈,现在可以了。在MFC 7。0中
有不少的工具类可以在ATL和MFC之间共享:CString,CPoint,CRect,CSize和CImage。而且,ATL可以在
无需MFC支持的情况下使用。
CString被完全改写了,现在基于模板类CStringT<>。它支持各种字符类型(char, wchar_t, TCHAR)和
建立在CRT的基础上。你还可以在CString中自行管理内存的分配。
【译者:比如
typedef struct my_chr {
unsigned int a;
unsigned int b;
unsigned int c;
} MY_CHR;
CStringT<MY_CHR> My_Str;
...
】
MFC7.0增加了一个新的字符串类叫CFixedStringT<>。这种定长字符串提供一种用户定义长度的方法,在耗尽
内在的空间前无需额外的内存。CFixedStringT被用于基于栈的变量或联合容器中的元素时,效率非常高。
它显著地减少了基于堆的分配。
【译者:这里俺也糊涂了,呵呵,请各位指正。原文如下:
CFixedStringT's are very efficient when used as stack-based variables or as keys in associative
containers, dramatically reducing the number of heap-based allocations.
】
<HTML><BODY>
Filename: <SPAN ID="filename"></SPAN><BR>
<INPUT ID="readonly" TYPE="checkbox" ACCESSKEY="r">
<U>R</U>ead-only
</BODY></HTML>
void CPropertiesDlg::DoDataExchange(CDataExchange* pDX) {
CDHtmlDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPropertiesDlg)
//}}AFX_DATA_MAP
DDX_DHtml_ElementInnerText(pDX, _T("filename"), m_strFileName);
DDX_DHtml_CheckBox(pDX, _T("readonly"), m_nReadOnly); }
To respond to HTML control events, you have to define a DHTML event map: