//  Callback.h

#if !defined(CALLBACK_H)
#define CALLBACK_H

#include "PubHeader.h"

#include <stdarg.h>
#include <stdio.h>

#ifdef _DLL_PROJECT
class CLASS_EXPORT cCallback
#else
class cCallback
#endif
{
public:
    enum { MAX_PARAMS=10 };

    typedef DWORD (*tFunction)(void* pParent, unsigned int params_num, DWORD params[]);

public:
    cCallback();
   ~cCallback();
    
    void setCallback(void* handler, tFunction pFunctionPointer);
    void clone(cCallback& Callback);

    bool isSeted();

    ///////////////////////////////////////////////////
    bool setParams(unsigned int num, ... );   // DWORD param...
    bool setParams(unsigned int num, DWORD params[]);
        
    long CallbackProc(long default_failret=0);

private:
    void*        m_handler;
    tFunction    m_pFunction;

    unsigned int m_nParamNum;
    DWORD        m_Params[MAX_PARAMS];
};


#endif // CALLBACK_H




