类的声明如下:
class CPalette : public CGdiObject
{
DECLARE_DYNAMIC(CPalette)public:
static CPalette* PASCAL FromHandle(HPALETTE hPalette);// Constructors
CPalette();
BOOL CreatePalette(LPLOGPALETTE lpLogPalette);
BOOL CreateHalftonePalette(CDC* pDC);// Attributes
operator HPALETTE() const;
int GetEntryCount();
UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
LPPALETTEENTRY lpPaletteColors) const;
UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
LPPALETTEENTRY lpPaletteColors);// Operations
void AnimatePalette(UINT nStartIndex, UINT nNumEntries,
LPPALETTEENTRY lpPaletteColors);
UINT GetNearestPaletteIndex(COLORREF crColor) const;
BOOL ResizePalette(UINT nNumEntries);// Implementation
virtual ~CPalette();
};
我想问的是DECLARE_DYNAMIC(CPalette)有什么作用,哪位知道?3x

解决方案 »

  1.   

    DECLARE_DYNAMICSee Also
    MFC Macros and Globals | IMPLEMENT_DYNAMIC | DECLARE_DYNCREATE | DECLARE_SERIAL | RUNTIME_CLASS | CObject::IsKindOf
    Adds the ability to access run-time information about an object's class when deriving a class from CObject.DECLARE_DYNAMIC(class_name )
    Parameter
    class_name 
    The actual name of the class. 
    Res
    Add the DECLARE_DYNAMIC macro to the header (.h) module for the class, then include that module in all .cpp modules that need access to objects of this class.If you use the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC macros as described, you can then use the RUNTIME_CLASS macro and the CObject::IsKindOf function to determine the class of your objects at run time.If DECLARE_DYNAMIC is included in the class declaration, then IMPLEMENT_DYNAMIC must be included in the class implementation.For more information on the DECLARE_DYNAMIC macro, see CObject Class Topics.
      

  2.   

    wuxuan(真心英雄)说的已经够 了,不够 的话<<深入浅出MFC>>