ComWindow.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:1k
源码类别:

模拟服务器

开发平台:

C/C++

  1. // -------------------------------------------------------------------------
  2. // 文件名 : ComWindow.h
  3. // 创建者 : 万里
  4. // 创建时间 : 2003-7-24 10:33:52
  5. // 功能描述 :
  6. //
  7. // -------------------------------------------------------------------------
  8. #ifndef __COMWINDOW_H__
  9. #define __COMWINDOW_H__
  10. class KWndWindow;
  11. struct KComClassInfo
  12. {
  13. char szClassType[32];
  14. KWndWindow* (* pfnCreateObject)();
  15. };
  16. class KComClassFactory
  17. {
  18. public:
  19. KComClassFactory();
  20. KComClassInfo* FindComClass(const char* szClassType);
  21. KComClassInfo* FindComClass(const KComClassInfo* pDest);
  22. KWndWindow* CreateComObject(const char* szClassType);
  23. int RegisterComClass(const KComClassInfo& one);
  24. };
  25. KComClassFactory* gGetComClassFactory();
  26. #define DECLARE_COMCLASS(class_name) 
  27. static KComClassInfo m_one; 
  28. static void class_name::RegisterSelfClass() 
  29. { gGetComClassFactory()->RegisterComClass(m_one); } 
  30. static KWndWindow* class_name::CreateObject() 
  31. { return new class_name; } 
  32. static KComClassInfo* class_name::GetComClassInfo() 
  33. { return &m_one; }
  34. #define IMPLEMENT_COMCLASS(class_name) 
  35. KComClassInfo class_name::m_one = 
  36. { #class_name,  class_name::CreateObject };
  37. #endif // __COMWINDOW_H__