www.pudn.com > SendMsgOCX.rar > WMsgSentHistory.h


// WMsgSentHistory.h: interface for the CWMsgSentHistory class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_WMSGSENTHISTORY_H__4F5EDDEE_9238_4B20_876A_2B28428B8259__INCLUDED_) 
#define AFX_WMSGSENTHISTORY_H__4F5EDDEE_9238_4B20_876A_2B28428B8259__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "WMsgSent.h" 
#include  
#include  
#include "ArrayTempl.h" 
 
class CWMsgLastFrameNo 
{ 
public : 
 
	CWMsgLastFrameNo(LPCSTR lpcszPhoneNumber=""); 
 
	int operator - (const CWMsgLastFrameNo& toMinus) const; 
	int Compare( const CWMsgLastFrameNo& toCmp) const; 
	 
	BYTE GenerateNextFrameNo(); 
	BYTE GetFrameNo() const; 
 
private: 
 
	char  m_szPhoneNumber[MAX_PHONE_NUMBER_LEN+1];	// to where 
	BYTE  m_lastFrameNo;							 
	 
}; 
 
class CWMsgSentHistory  : CList 
{ 
public: 
	 
	CWMsgSentHistory(); 
	 ~CWMsgSentHistory(); 
 
	// save msg and get frame no , send time etc. 
	// return FALSE if can not generate an free frame no 
    BOOL SaveMsg(CWMsgSent& msg); 
 
	// has ? 
	// toFindAndGet, [ in ] phone number and frame no, [out] other content 
	// bResetSaveTime  
	BOOL GetACopy(CWMsgSent& toFindAndGet, BOOL bResetSaveTime); 
 
	void SetTimeOut(const MsgTimeOutType& timeOut); 
 
	void ResetSaveTime(); 
 
private: 
 
	static MsgSaveTimeType GetSaveTime(); 
 
	// remove time out one  
	void RemoveTimeOutItem(); 
	BOOL HasDuplicateItem(const CWMsgSent& toCheck); 
	POSITION FindDuplicateItem(const CWMsgSent& toCheck); 
	BYTE GenerateNextFrameNo(LPCSTR lpcszPhoneNumber); 
 
	// check if the message is timeout(true) 
	BOOL CheckTimeOut(const MsgSaveTimeType& currTime, const CWMsgSent& toCheck) const; 
 
	BOOL IsLocked() const; 
	void Lock(); 
	void Unlock(); 
 
	CCriticalSection m_criticalSection; 
	BOOL m_bLocked; 
 
	MsgTimeOutType m_timeOut; 
	 
	CMyArray m_frameNoHistory; 
 
}; 
 
#endif // !defined(AFX_WMSGSENTHISTORY_H__4F5EDDEE_9238_4B20_876A_2B28428B8259__INCLUDED_)