#pragma once

#include <afxmt.h>
#include "MyWait.h"

#include "DllDefines.h"

class UTILITYDLL CEvt : public CMyWait
{
public:
    CEvt();                       // create an object without name, this object can only be used in the local thread
    explicit CEvt(LPCTSTR pszNo); // create an object with the name pszNo

    HANDLE GetEvt(BOOL bState);
    ~CEvt();

    BOOL operator=(const BOOL bState);
    BOOL operator==(const BOOL bState);
    BOOL operator!=(const BOOL bState);
    // Operations
    BOOL WaitEvt(DWORD dwTimeOut = INFINITE);
    BOOL WaitResetEvt(DWORD dwTimeOut = INFINITE);
    BOOL WaitEvtEx(DWORD dwTimeOut = INFINITE);
    BOOL WaitResetEvtEx(DWORD dwTimeOut = INFINITE);
    BOOL Reset(void);
    BOOL Set(void);

    std::string GetEvtName();

private:
    std::string m_strName;
    CEvent m_evtActivate;
    CEvent m_evtDeactivate;
};