WEB开发网
开发学院软件开发VC MFC教程(9)-- MFC的进程和线程(1) 阅读

MFC教程(9)-- MFC的进程和线程(1)

 2010-03-25 20:35:08 来源:WEB开发网   
核心提示:CNoTrackObject类在图9-3中, CnoTrackObject是根类,MFC教程(9)-- MFC的进程和线程(1)(2),所有状态类都是从它这里派生的,其定义如下:class CNoTrackObject{public:void* PASCAL operator new(size_t nSize);voi

CNoTrackObject类

在图9-3中, CnoTrackObject是根类,所有状态类都是从它这里派生的,其定义如下:

class CNoTrackObject

{

public:

void* PASCAL operator new(size_t nSize);

void PASCAL operator delete(void*);

#if defined(_DEBUG) && !defined(_AFX_NO_DEBUG_CRT)

void* PASCAL operator new(size_t nSize, LPCSTR, int);

#endif

virtual ~CNoTrackObject() { }

};

该类的析构函数是虚拟函数;而且,CNoTrackObject重载new操作符用来分配内存,重载delete操作符号用来释放内存,内部通过LocalAlloc/LocalFree提供了一个低层内存分配器(Low_level alloctor)。---www.bianceng.cn

AFX_MODULE_STATE类

AFX_MODULE_STATE类的定义如下:

// AFX_MODULE_STATE (global data for a module)

class AFX_MODULE_STATE : public CNoTrackObject

{

public:

#ifdef _AFXDLL

AFX_MODULE_STATE(BOOL bDLL,WNDPROC pfnAfxWndProc,

DWORD dwVersion);

AFX_MODULE_STATE(BOOL bDLL, WNDPROC pfnAfxWndProc,

DWORD dwVersion,BOOL bSystem);

#else

AFX_MODULE_STATE(BOOL bDLL);

#endif

~AFX_MODULE_STATE();

CWinApp* m_pCurrentWinApp;

HINSTANCE m_hCurrentInstanceHandle;

HINSTANCE m_hCurrentResourceHandle;

LPCTSTR m_lpszCurrentAppName;

BYTE m_bDLL;// TRUE if module is a DLL, FALSE if it is an EXE

//TRUE if module is a "system" module, FALSE if not

BYTE m_bSystem;

BYTE m_bReserved[2]; // padding

//Runtime class data:

#ifdef _AFXDLL

CRuntimeClass* m_pClassInit;

#endif

CTypedSimpleList<CRuntimeClass*> m_classList;

// OLE object factories

#ifndef _AFX_NO_OLE_SUPPORT

#ifdef _AFXDLL

COleObjectFactory* m_pFactoryInit;

#endif

CTypedSimpleList<COleObjectFactory*> m_factoryList;

#endif

// number of locked OLE objects

long m_nObjectCount;

BOOL m_bUserCtrl;

// AfxRegisterClass and AfxRegisterWndClass data

TCHAR m_szUnregisterList[4096];

#ifdef _AFXDLL

WNDPROC m_pfnAfxWndProc;

DWORD m_dwVersion; // version that module linked against

#endif

// variables related to a given process in a module

// (used to be AFX_MODULE_PROCESS_STATE)

#ifdef _AFX_OLD_EXCEPTIONS

// exceptions

AFX_TERM_PROC m_pfnTerminate;

#endif

void (PASCAL *m_pfnFilterToolTipMessage)(MSG*, CWnd*);

#ifdef _AFXDLL

// CDynLinkLibrary objects (for resource chain)

CTypedSimpleList<CDynLinkLibrary*> m_libraryList;

// special case for MFCxxLOC.DLL (localized MFC resources)

HINSTANCE m_appLangDLL;

#endif

#ifndef _AFX_NO_OCC_SUPPORT

// OLE control container manager

COccManager* m_pOccManager;

// locked OLE controls

CTypedSimpleList<COleControlLock*> m_lockList;

#endif

#ifndef _AFX_NO_DAO_SUPPORT

_AFX_DAO_STATE* m_pDaoState;

#endif

#ifndef _AFX_NO_OLE_SUPPORT

// Type library caches

CTypeLibCache m_typeLibCache;

CMapPtrToPtr* m_pTypeLibCacheMap;

#endif

// define thread local portions of module state

THREAD_LOCAL(AFX_MODULE_THREAD_STATE, m_thread)

};

上一页  1 2 3 4 5 6 7  下一页

Tags:MFC 教程 MFC

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接