메뉴 건너뛰기

OBG

Programming

MoA
조회 수 4742 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
http://lafirr.tistory.com/56

추가 : http://greenfishblog.tistory.com/29

콘솔 프로그램이면 모르겠지만

MFC 에서 Sleep() 을 걸면, (물론 거는 위치에 따라서 다르겠지만)

모든 메세지가 먹통이 되기 때문에

원하지 않는 결과를 초래할 수도 있습니다.

예를 들어서 10초 정지 후 메세지 출력 후 500ms 정지... 같은 경우

프로그램이 갑자기 (응답없음)으로 바뀌더니 메세지가 출력되는것도 보이지 않고 바로

ㄱㄱㄱ 해버리는... ㄷㄷㄷ

따라서 MFC 에서는 Sleep() 을 가급적 (..제발) 쓰지 말고

다음과 같은 함수를 추가해서 사용하는 것이 바람직하다고 합니다.

void CNumberGameDlg::Wait(DWORD dwMillisecond)
{
 MSG msg;
 DWORD dwStart;
 dwStart = GetTickCount();

 while(GetTickCount() - dwStart < dwMillisecond)
 {
  while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  {
   TranslateMessage(&msg);
   DispatchMessage(&msg);
  }
 }
}


?

  1. Programming 게시판 관련

    Date2014.11.01 CategoryTool/etc ByMoA Views1748
    read more
  2. VC++6.0 에서 VC++ 2005로 변환할 경우 형변환 경고 대응방법

    Date2013.07.28 CategoryAPI/MFC ByMoA Views628
    Read More
  3. Using Machine Learning to Predict Customers’ Next Purchase Day

    Date2024.02.27 CategoryDeeplearning ByOBG Views40
    Read More
  4. UpdateWindow 함수에 대하여..

    Date2013.07.25 CategoryAPI/MFC ByMoA Views472
    Read More
  5. UpdateDialogControls

    Date2013.09.05 CategoryAPI/MFC ByMoA Views807
    Read More
  6. UpdateData(TRUE) or UpdateData(FALSE) 구분

    Date2013.07.28 CategoryAPI/MFC ByMoA Views445
    Read More
  7. unsigned char <-> 유니코드(unicode) 및, string 변환 매크로 - USES_CONVERSION

    Date2013.07.28 CategoryAPI/MFC ByMoA Views1334
    Read More
  8. UI Guidelines

    Date2014.03.11 CategoryTool/etc ByMoA Views519
    Read More
  9. Top 3 most used Pytorch Ecosystem Libraries you should Know about

    Date2023.08.02 CategoryDeeplearning ByOBG Views89
    Read More
  10. Thread와 SendMessage를 통해 DeadLock을 만드는 방법

    Date2013.07.28 CategoryAPI/MFC ByMoA Views2625
    Read More
  11. Thread에서 Dialog의 UpdateData()사용하는 방법

    Date2011.09.26 CategoryAPI/MFC By너울 Views1126
    Read More
  12. Thread Programming

    Date2012.08.02 CategoryAPI/MFC ByNaya Views597
    Read More
  13. The State of AI & Art 2022

    Date2022.10.06 CategoryDeeplearning ByOBG Views138
    Read More
  14. The difference between quantization methods for the same bits

    Date2024.04.14 CategoryLLM ByOBG Views33
    Read More
  15. Synology: Top Best Apps For Docker

    Date2024.07.01 CategoryTool/etc ByOBG Views6
    Read More
  16. stdafx.h 사용 (미리 컴파일된 헤더)

    Date2012.08.13 CategoryAPI/MFC ByNaya Views723
    Read More
  17. Start Something! - Windows 8 개발 공식 사이트

    Date2012.08.02 CategorySite ByNaya Views257
    Read More
  18. Stable Diffusion

    Date2022.09.27 CategoryDeeplearning ByOBG Views148
    Read More
  19. SSH-Tunneling을 통한 MySQL 서버 연결

    Date2023.04.21 Category서버 ByOBG Views134
    Read More
  20. Sleep() 함수 대신 프로그램 딜레이 시키기 (Wait)

    Date2013.07.28 CategoryAPI/MFC ByMoA Views4742
    Read More
  21. Simplified Logger Class

    Date2013.07.28 CategoryC/C++ ByMoA Views417
    Read More
Board Pagination Prev 1 ... 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15
위로