내가 GDI 누수의 작은 문제가 새어 나는 윈도우 전 생성 및 처리에 특정 데이터를 enfolds 클래스가 this.Say 해결하는 방법에 대한 다른 사람의 의견을 알고 싶어 :에서 Win32 글꼴 자원
class Wnd {
HWND hWnd;
HFONT hFont;
LOGFONT LogFont;
//etc
public:
//constructors and member functions
//The following function atempts to change the font of the window
//pointed to by the hWnd parameter
void ChangeFont (const LOGFONT& lf) {
std::memcpy (&LogFont,&lf,sizeof(LOGFONT));
hFont=CreateFontIndirect (&LogFont);
SendMessage (hWnd,WM_SETFONT,(WPARAM) hFont,(LPARAM) 1);
}
~Wnd() {
//i don't think this would work since i haven't used the SelectObject function
DeleteObject ((HGDIOBJ) hFont);
}
};
을
그래서 주요 시간은 파기 시간에 어떻게 hFont 매개 변수에 할당 된 메모리를 해제해야합니까? 창에 대한 장치 컨텍스트를 가져와 SelectObject() 함수를 사용해야 만 이후에 함수를 사용하여 메모리를 해제하려면 DeleteObject() 사용합니까? 고마워요.
답변 해 주셔서 감사합니다. –