First time

This is the first composition of my personal blog, just for test whether if this blog supports the highlight of the code!

Cheers!

 

Take the MFC.h file as example:

 

C++语言 : Codee#19538
#define TRUE 1
#define FALSE 0

typedef char * LPSTR ;
typedef const char * LPCSTR ;

typedef unsigned long   DWORD ;
typedef int             BOOL ;
typedef unsigned char   BYTE ;
typedef unsigned short WORD ;
typedef int             INT ;
typedef unsigned int    UINT ;
typedef long            LONG ;

#define WM_COMMAND             0x0111
#define CObjectid              0xffff
#define   CCmdTargetid         1
#define     CWinThreadid       11
#define       CWinAppid        111
#define         CMyWinAppid    1111
#define     CWndid             12
#define       CFrameWndid      121
#define         CMyFrameWndid  1211
#define       CViewid          122
#define         CMyViewid      1221
#define     CDocumentid        13
#define       CMyDocid         131

#include <iostream.h>

///
// Window message map handling

struct AFX_MSGMAP_ENTRY ;       // declared below after CWnd

struct AFX_MSGMAP
{
        AFX_MSGMAP * pBaseMessageMap ;
        AFX_MSGMAP_ENTRY * lpEntries ;
};

#define DECLARE_MESSAGE_MAP() /
        static AFX_MSGMAP_ENTRY _messageEntries[]; /
        static AFX_MSGMAP messageMap; /
        virtual AFX_MSGMAP* GetMessageMap() const;

#define BEGIN_MESSAGE_MAP(theClass, baseClass) /
        AFX_MSGMAP* theClass::GetMessageMap() const /
                { return &theClass::messageMap; } /
        AFX_MSGMAP theClass::messageMap = /
        { &(baseClass::messageMap), /
                (AFX_MSGMAP_ENTRY*) &(theClass::_messageEntries) }; /
        AFX_MSGMAP_ENTRY theClass::_messageEntries[] = /
        {

#define END_MESSAGE_MAP() /
        { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)0 } /
        };

// Message map signature values and macros in separate header
#include <afxmsg_.h>

class CObject
{
public :
  CObject :: CObject ()  {
                      }
  CObject ::~ CObject () {
                      }
};

class CCmdTarget : public CObject
{
public :
  CCmdTarget :: CCmdTarget ()  {
                            }
  CCmdTarget ::~ CCmdTarget () {
                            }
  DECLARE_MESSAGE_MAP ()       // base class - no {{ }} macros
};

typedef void ( CCmdTarget ::* AFX_PMSG )( void );

struct AFX_MSGMAP_ENTRY   // MFC 4.0
{
    UINT nMessage ; // windows message
    UINT nCode ;    // control code or WM_NOTIFY code
    UINT nID ;      // control ID (or 0 for windows messages)
    UINT nLastID// used for entries specifying a range of control id's
    UINT nSig ;     // signature type (action) or pointer to message #
    AFX_PMSG pfn// routine to call (or special value)
};

class CWinThread : public CCmdTarget
{
public :
  CWinThread :: CWinThread ()  {
                            }
  CWinThread ::~ CWinThread () {
                            }

  virtual BOOL InitInstance () {
                                cout << "CWinThread::InitInstance /n " ;
                                return TRUE ;
                              }
  virtual int Run () {
                      cout << "CWinThread::Run /n " ;
                      return 1 ;
                    }
};

class CWnd ;

class CWinApp : public CWinThread
{
public :
  CWinApp * m_pCurrentWinApp ;
  CWnd * m_pMainWnd ;

public :
  CWinApp :: CWinApp ()  {
                        m_pCurrentWinApp = this ;
                      }
  CWinApp ::~ CWinApp () {
                      }

  virtual BOOL InitApplication () {
                                   cout << "CWinApp::InitApplication /n " ;
                                   return TRUE ;
                                 }
  virtual BOOL InitInstance ()    {
                                   cout << "CWinApp::InitInstance /n " ;
                                   return TRUE ;
                                 }
  virtual int Run () {
                      cout << "CWinApp::Run /n " ;
                      return CWinThread :: Run ();
                    }

  DECLARE_MESSAGE_MAP ()
};

typedef void ( CWnd ::* AFX_PMSGW )( void );
        // like 'AFX_PMSG' but for CWnd derived classes only

class CDocument : public CCmdTarget
{
public :
  CDocument :: CDocument ()   {
                           }
  CDocument ::~ CDocument ()  {
                           }
  DECLARE_MESSAGE_MAP ()
};

class CWnd : public CCmdTarget
{
public :
  CWnd :: CWnd ()   {
                 }
  CWnd ::~ CWnd ()  {
                 }

  virtual BOOL Create ();
  BOOL CreateEx ();
  virtual BOOL PreCreateWindow ();

  DECLARE_MESSAGE_MAP ()
};

class CFrameWnd : public CWnd
{
public :
  CFrameWnd :: CFrameWnd ()   {
                           }
  CFrameWnd ::~ CFrameWnd ()  {
                           }
  BOOL Create ();
  virtual BOOL PreCreateWindow ();

  DECLARE_MESSAGE_MAP ()
};

class CView : public CWnd
{
public :
  CView :: CView ()   {
                   }
  CView ::~ CView ()  {
                   }
  DECLARE_MESSAGE_MAP ()
};

// global function
CWinApp * AfxGetApp ();

 

Look at that, great hal~ Nice going~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
schedule(timertask task, date firsttime, long period) 是Java.util.Timer类的一个方法,用于定时调度任务。 参数task是一个实现了TimerTask接口的任务对象,该对象定义了要定时执行的具体任务。 参数firsttime是一个java.util.Date类型的对象,表示第一次执行任务的时间。该时间可以是过去的时间,表示立即执行任务,也可以是未来的时间,表示在指定时间执行任务。 参数period是一个long类型的值,表示任务执行的时间间隔,以毫秒为单位。如果设定为0,则表示任务仅执行一次;如果设定为正值,则表示任务将定期执行,每隔指定的时间间隔执行一次。 当调用了schedule方法后,Timer会按照设定的时间间隔反复执行任务。第一次任务执行的时间是由参数firsttime指定的,后续任务的执行时间会根据参数period和任务执行的实际耗时来确定。 需要注意的是,Timer是单线程的,如果前一次任务的执行时间超过了指定的时间间隔,则后续任务的执行会被延迟。因此,如果任务的执行时间较长,可能会导致任务积压和延迟。 此外,如果任务的执行过程中抛出异常,Timer会终止整个任务调度,停止后续任务的执行。因此,为了保证任务的稳定执行,需要在任务内部做好异常处理。 总之,schedule方法可以用于在指定的时间间隔内定时执行任务,适用于一些需要按照固定时间间隔执行的操作,如定时刷新数据、定时备份文件等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值