°¡»ó BOOL OnIdle ( ±ä lCount );
¹Ýȯ °ª
Nonzero ¹ÞÀ» ´õ À¯ÈÞ Ã³¸® ½Ã°£; ´õ ÀÌ»ó À¯ÈÞ ½Ã°£ÀÌ ÇÊ¿äÇÑ °æ¿ì 0¡£
¸Å°³ º¯¼ö
lCount
OnIdle ¶§¸¶´Ù Áõ°¡ ÇÏ´Â Ä«¿îÅÍ´Â ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ¸Þ½ÃÁö Å¥°¡ ºñ¾î ÀÖÀ¸¸é È£Ã⠵˴ϴÙ. ÀÌ °³¼ö°¡ 0 »õ ¸Þ½ÃÁö°¡ ó¸® µÉ ¶§¸¶´Ù Àç¼³Á¤ µË´Ï´Ù. LCount ¸Å°³ º¯¼ö¸¦ »ç¿ë ÇÏ ¿© ÀÀ¿ë ÇÁ·Î±×·¥ÀÌ ¸Þ½ÃÁö¸¦ ó¸® ÇÏÁö ¾Ê°í À¯ÈÞ µÇ¾ú½À´Ï´Ù »ó´ë ±â°£ °áÁ¤¡£
ÁÖÀÇ
À¯ÈÞ ½Ã°£ 󸮸¦ ¼öÇà ÇÏ·Á¸éÀÌ ¸â¹ö ÇÔ¼ö¸¦ ÀçÁ¤ÀÇ ÇÕ´Ï´Ù. ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ¸Þ½ÃÁö Å¥°¡ ºñ¾î ÀÖÀ¸¸é ±âº» ¸Þ½ÃÁö ·çÇÁ¿¡¼ OnIdle ¶ó°í ÇÕ´Ï´Ù. ±ÍÇÏÀÇ ÀçÁ¤ÀÇ »ç¿ë ÇÏ ¿© ÀÚ½ÅÀÇ ¹è°æ À¯ÈÞ Ã³¸®±â ÀÛ¾÷ È£Ãâ¡£
OnIdle À¯ÈÞ Ã³¸® ½Ã°£ÀÌ ÇÊ¿ä ÇÏ´Ù´Â ³ªÅ¸³»´Â 0À» ¹Ýȯ ÇØ¾ß ÇÕ´Ï´Ù. LCount ¸Å°³ º¯¼ö´Â °¢ ½Ã°£ Áõ°¡ È£Ãâ OnIdle messagenbsp; Å¥°¡ ºñ¾î¿Í »õ ¸Þ½ÃÁö°¡ ó¸® µÉ ¶§¸¶´Ù 0À¸·Î ´Ù½Ã ¼³Á¤ ÇÕ´Ï´Ù. ÀÌ °ª¿¡ µû¶ó ´Ù¸¥ À¯ÈÞ ·çƾÀ» È£ÃâÇÒ ¼ö ÀÖ½À´Ï´Ù(&N).
´ÙÀ½ ¿ä¾à À¯ÈÞ ·çÇÁ ó¸®:
OnIdle application °³Ã¼ ¹× ¼Ò¸ðǰ 0 lCount Àμö¿¡ ´ë ÇÑ¡£OnIdleÀϺΠ󸮸¦ ¼öÇà ÇÏ °í ¹ÝȯÀ» ÇÒ ±×°ÍÀ» ³ªÅ¸³»±â À§ÇØ 0ÀÌ ¾Æ´Ñ °ªÀ» ´Ù½Ã È£Ãâ ÇØ¾ß Ãß°¡ 󸮡£OnIdle lCount Àμö¸¦ ´Ù½Ã Áõ°¡¡£OnIdle ¸ðµç À¯ÈÞ ÀÛ¾÷ 󸮸¦ Á¾·á ÇÏ °í 0À» ¹Ýȯ ÇÕ´Ï´Ù. ÀÌ È£ÃâÀ» ÁßÁö ¸Þ½ÃÁö ·çÇÁ¸¦ ¾Ë·ÁÁÝ´Ï´Ù OnIdle ¸Þ½ÃÁö ´ë±â¿¿¡¼ ´ÙÀ½ ¸Þ½ÃÁö¸¦ ¹ÞÀ» ¶§±îÁö À¯ÈÞ »çÀÌŬ Àμö¿Í ÇÔ²² ´Ù½Ã ½ÃÀÛ ÁöÁ¡ ¼³Á¤ tonbsp; 0(&N)¡£ÀÀ¿ë ÇÁ·Î±×·¥ OnIdle ¹Ýȯ µÉ ¶§±îÁö »ç¿ëÀÚ ÀÔ·ÂÀ» ó¸®ÇÒ ¼ö ¾ø½À´Ï´Ù ¶§¹®¿¡ OnIdle µ¿¾È ±ä ÀÛ¾÷À» ¼öÇà ÇÏÁö ¸¶½Ê½Ã¿À¡£
¸Þ¸ðnbsp;??¸í·É ¸Þ´º Ç׸ñ ¹× µµ±¸ ¸ðÀ½ ´ÜÃß¿Í °°Àº »ç¿ëÀÚ ÀÎÅÍÆäÀ̽º °³Ã¼¸¦ ¾÷µ¥ÀÌÆ® ÇÏ´Â OnIdle ÀÇ ±âº» ±¸Çö ÇÏ °í ³»ºÎ µ¥ÀÌÅÍ ±¸Á¶ Á¤¸®¸¦ ¼öÇà ÇÕ´Ï´Ù. µû¶ó¼, OnIdleÀçÁ¤ÀÇ ÇÏ´Â °æ¿ì È£Ãâ ÇØ¾ß ÇÕ´Ï´Ù CWinApp::OnIdle lCount ¿Í ÇÔ²² ÀçÁ¤ÀÇ µÈ ¹öÀü. óÀ½ È£Ãâ ÇÏ´Â ¸ðµç ±âº» Ŭ·¡½º À¯ÈÞ Ã³¸® (Áï, ±âº» Ŭ·¡½º OnIdle ¹Ýȯ µÉ ¶§±îÁö 0). ±âº» Ŭ·¡½º 󸮸¦ ¿Ï·á Çϱâ Àü¿¡ ÀÛ¾÷À» ¼öÇà ÇØ¾ß ÇÏ´Â °æ¿ì ±ÍÇÏÀÇ ÀÛ¾÷À» ¼öÇà ÇÏ´Â µ¿¾È ÀûÀý ÇÑ lCount ¼±Åà ÇÏ·Á¸é ±âº» Ŭ·¡½º ±¸ÇöÀ» °ËÅäÇÕ´Ï´Ù(&N)¡£
¿¹Á¦
´ÙÀ½ µÎ ¿¹Á¦ OnIdle»ç¿ë ÇÏ´Â ¹æ¹ýÀ» º¸¿© ÁÝ´Ï´Ù. ù ¹øÂ° ¿¹¿¡¼´Â µÎ °³ÀÇ À¯ÈÞ ÀÛ¾÷ lCount Àμö¸¦ »ç¿ë ÇÏ ¿© ÀÛ¾÷À» ¿ì¼± ¼øÀ§¸¦ ó¸® ÇÕ´Ï´Ù. ù ¹øÂ° ÀÛ¾÷Àº ¿ì¼± ¼øÀ§°¡ ³ôÀº ÇÏ °í °¡´É ÇÏ¸é ±×°ÍÀ» ¾î¶»°Ô ÇØ¾ß ÇÕ´Ï´Ù. µÎ ¹øÂ° ÀÛ¾÷ ´ú Áß¿ä ÇÏ °í °Å±â¿¡ »ç¿ëÀÚ ÀԷ¿¡ ±ä ÀϽà ÁßÁö ÇÏ´Â °æ¿ì¿¡ ÀÌ·ç¾îÁ®¾ß ÇÑ´Ù. Note OnIdleÀÇ ±âº» Ŭ·¡½º ¹öÀüÀ» È£Ãâ ÇÕ´Ï´Ù. µÎ ¹øÂ° ¿¹¿¡¼´Â ´Ù¸¥ ¿ì¼±¼øÀ§¿Í À¯ÈÞ ÀÛ¾÷ ±×·ì °ü¸®¡£
BOOL CMyApp::OnIdle(LONG lCount)
{
nbsp;? BOOL bMore = CWinApp::OnIdle(lCount);
°æ¿ì (lCount = = 0)
?? {
?? ÃßÀû ("ÀÀ¿ë ÇÁ·Î±×·¥ time\nÀÇ ÂªÀº ±â°£¿¡ ´ë ÇÑ À¯ÈÞ");
?? bMore = TRUE;
?? }
?? else if (lCount = = 10)
?? {
?? ÃßÀû ("ÀÀ¿ë ÇÁ·Î±×·¥ time\nÀÇ ±ä ½Ã°£ µ¿¾È À¯ÈÞ »óÅÂ");
?????? bMore = TRUE;
?? }
?? else if (lCount = 100)
?? {
?????? ÃßÀû ("ÀÀ¿ë ÇÁ·Î±×·¥ time\nÀÇ ´õ ±ä ±Ý¾×¿¡ ´ë ÇÑ À¯ÈÞ");
?????? bMore = TRUE;
?? }
?? else if (lCount = 1000)
?? {
?????? ÃßÀû ("ÀÀ¿ë ÇÁ·Î±×·¥ time\n ²Ï ¿À·£ ±â°£ µ¿¾È À¯ÈÞ");
??? / / BmoreÀ» true·Î ¼³Á¤ ÇÏÁö ¾ÊÀ¸¸é, ´õ ÀÌ»ó ÇÊ¿ä ¾ø´Â À¯ÈÞ
??? / / Áß¿ä: ÀÌÈÄ CWinApp::OnIdle ¼ö ÀÖ½À´Ï´Ù BmoreÀ» false·Î ¼³Á¤ µÇÁö ¾ÊÀº
??? / / ´õ ¸¹Àº À¯ÈÞ ÀÛ¾÷À» ¿Ï·á ÇÕ´Ï´Ù.
?? }
¹Ýȯ bMore;
??? / / TRUE¸¦ ¹Ýȯ ÇÏ´Â ¸¸Å ´õ À¯ÈÞ ÀÛ¾÷
}(&N)
µÎ ¹øÂ° ¿¹Á¦
// In this example, four idle loop tasks are given various
// opportunities to run:
// Task1 is always given a chance to run during idle time, provided
// that no message has queued up while the framework was processing
// its own idle loop tasks (at lCount levels 0 and 1).
// Task2 is given a chance to run only if Task1 has already run,
// provided that no message has queued up while Task1 was running.
// Task3 and Task4 are given a chance to run only if both Task1 and
// Task2 have already run, and no message has queued up in the mean
// time. If Task3 gets its chance to run, then Task4 always gets
// a chance to run immediately after Task3.
BOOL CMyApp::OnIdle(LONG lCount)
{
// In this example, as in most applications, you should let the
// base class CWinApp::OnIdle complete its processing before you
// attempt any additional idle loop processing.
if (CWinApp::OnIdle(lCount))
return TRUE;
// The base class CWinApp::OnIdle reserves the lCount values 0
// and 1 for the framework's own idle processing. If you wish to
// share idle processing time at a peer level with the framework,
// then replace the above if-statement with a straight call to
// CWinApp::OnIdle; and then add a case statement for lCount value
// 0 and/or 1. Study the base class implementation first to
// understand how your idle loop tasks will compete with the
// framework's idle loop processing.
switch (lCount)
{
case 2:
Task1();
return TRUE; // next time give Task2 a chance
case 3:
Task2();
return TRUE; // next time give Task3 and Task4 a chance
case 4:
Task3();
Task4();
return FALSE; // cycle through the idle loop tasks again
}
return FALSE;
}
CWinApp °³¿ä |nbsp; Ŭ·¡½º ¸â¹ö (ko) | °èÃþ ±¸Á¶ Â÷Æ®(&N)