readme.wzd

来自「E:Visual_C__MFC扩展编程实例 实例47:等待消息」· WZD 代码 · 共 48 行

WZD
48
字号
/////////////////////////////////////////////////////////////////////
// Modify any class.
/////////////////////////////////////////////////////////////////////

// 1) to wait till m_bWait is FALSE
	MSG msg;
	BOOL bIdle=TRUE;
	LONG lIdleCount = 0;
	CWinApp* pApp=AfxGetApp();

	AfxMessageBox("Into wait loop.");
	m_bWait=TRUE;
	while (m_bWait)
	{
		// idle loop waiting for messages
		while (bIdle && !::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
		{
			if (!pApp->OnIdle(lIdleCount++)) bIdle = FALSE;
		}

		// process new messages
		do {
			// pump messages
			pApp->PumpMessage();

			// if we're done, let's go...
			if (!m_bWait)
				break;

			// otherwise keep looping
			if (pApp->IsIdleMessage(&msg))
			{
        			bIdle = TRUE;
					lIdleCount = 0;
			}
		} while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE));
	}

// 2) to make m_bWait FALSE, use the ClassWizard to add a message handler, typically 
// for a mouse or key message to indicate the user has done something. Set m_bWait 
// to FALSE in that handler.

/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1999 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?