AfxRegisterClass을 하면 CPU사용률이 100%가 됩니다...
글쓴이: jic5760 / 작성시간: 토, 2015/08/01 - 12:02오전
뭐 별다른 소스는 없구 그냥 MFC Dialog에서 IDC_CUSTOM을 만들고 클래스를 지정해 주었습니다.
class CCustom :
public CWnd
이런식으로 Class을 만들어 주고 기본적인 헤더파일을 만들어 주고...
CCustom::CCustom(void)
{
RegisterWindowClass();
}
CCustom::~CCustom(void)
{
}
BOOL CCustom::RegisterWindowClass()
{
WNDCLASS wndcls;
HINSTANCE hInst = AfxGetInstanceHandle();
g_loaded = false;
if ( !(::GetClassInfo(hInst, JSADMODULE_CLASSNAME, &wndcls)) )
{
wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
wndcls.lpfnWndProc = ::DefWindowProc;
wndcls.cbClsExtra = wndcls.cbWndExtra = 0;
wndcls.hInstance = hInst;
wndcls.hIcon = NULL;
wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
wndcls.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1);
wndcls.lpszMenuName = NULL;
wndcls.lpszClassName = JSADMODULE_CLASSNAME;
if (!AfxRegisterClass(&wndcls))
{
AfxThrowResourceException();
return FALSE;
}
}
return TRUE;
}
BEGIN_MESSAGE_MAP(CCustom, CWnd)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
END_MESSAGE_MAP()이렇게 해 주었는데 쓰레드 하나가 CPU사용률이 100%가 되버립니다...
왜이럴까요??
아 글구 AfxRegisterClass을 하면 새로 쓰레드가 생겨서 그 쓰레드가 Window을 담당하나요??
Forums:


OnPaint 문제였네요.
자문자답입니다.
OnPaint함수에
CPaintDC dc(this); 을 빠뜨려서 무한적으로 OnPaint가 호출되었던게 이유였습니다.ㅎ
감사합니다
참고 하였습니다 ^^
댓글 달기