msgdef.h 764 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __MSGDEF_H__
  2. #define __MSGDEF_H__
  3. #include "define.h"
  4. typedef struct _Message
  5. {
  6. int nNetCommand; // 网络命令
  7. unsigned long ulDataLen; // 数据长度
  8. void* pData; // 数据
  9. _Message()
  10. {
  11. nNetCommand = 0;
  12. ulDataLen = 0;
  13. pData = NULL;
  14. }
  15. ~_Message()
  16. {
  17. SafeRelease(pData);
  18. }
  19. }MESSAGE, *LPMESSAGE;
  20. typedef void (*EVENTHANDLE)(IN CONST int nEventID, IN LPMESSAGE pMsg, IN LPVOID pContext);
  21. typedef struct _SEvent
  22. {
  23. int nEventID; // 暂时没用
  24. LPMESSAGE pMsg; // 网络消息
  25. EVENTHANDLE eventHandle; // 事件处理
  26. LPVOID pContext;
  27. _SEvent()
  28. {
  29. nEventID = 0;
  30. memset(&pMsg, 0, sizeof(LPMESSAGE));
  31. pContext = NULL;
  32. }
  33. ~_SEvent()
  34. {
  35. SafeRelease(pMsg);
  36. }
  37. }SEVENT, *LPSEVENT;
  38. #endif //#ifndef __MSGDEF_H__