메뉴 건너뛰기

OBG

Programming

MoA
조회 수 4719 추천 수 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 게시판 관련

  2. Real-Time Stock News Sentiment Prediction with Python

  3. Redmine 설치

  4. Reinforcement Learning for Dynamic Pricing Suggestion

  5. RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED ...

  6. SciPy and NumPy

  7. Serial Communication in MFC

  8. Simple Add-On Wait Dialog in MFC

  9. Simplified Logger Class

  10. Sleep() 함수 대신 프로그램 딜레이 시키기 (Wait)

  11. SSH-Tunneling을 통한 MySQL 서버 연결

  12. Stable Diffusion

  13. Start Something! - Windows 8 개발 공식 사이트

  14. stdafx.h 사용 (미리 컴파일된 헤더)

  15. The difference between quantization methods for the same bits

  16. The State of AI & Art 2022

  17. Thread Programming

  18. Thread에서 Dialog의 UpdateData()사용하는 방법

  19. Thread와 SendMessage를 통해 DeadLock을 만드는 방법

  20. Top 3 most used Pytorch Ecosystem Libraries you should Know about

  21. UI Guidelines

Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 ... 15 Next
/ 15
위로