소스에 주석을 달아두었지만 이제 필요 없어져서 삭제하려는데 svn에 기록은 있으나 찾기 어려우므로 여기에 따로 올려둔다.


아래 내용 중 뭐가 틀렸는가 하면, visual studio 2010 sp1 버전 기준으로 iPaddedBorderWidth 멤버는 OS 버전이 0x0502 이하일 때 없는 게 아니라 0x0600 이상일 때 존재한다.

0x0502 와 0x0600 사이에는 sp 버전들이 존재하므로 두 설명이 완전 일치하지는 않는다.

(하지만 결국 코드는 지침대로 만들었다는 게 함정)



bool CRenderer::CreateNullFont()

{

    /*

        근데 문제는 아래 설명마저 틀렸어...

        If the iPaddedBorderWidth member of the NONCLIENTMETRICS structure is present,

        this structure is 4 bytes larger than for an application that is compiled with _WIN32_WINNT less than or equal to 0x0502.

        For more information about conditional compilation, see Using the Windows Headers.

    */


    OSVERSIONINFOW v = {sizeof(OSVERSIONINFOW)};

    if(GetVersionExW(&v) == FALSE)

    {

        this->WriteError(wstr(L"CreateNullFont::GetVersionEx() : %s",

            GetApiErrorString().c_str()));

        return false;

    }


    NONCLIENTMETRICSW s = {sizeof(NONCLIENTMETRICSW)};

    if(v.dwMajorVersion <= 5 && v.dwMinorVersion <= 2)

        s.cbSize -= sizeof(int);


    if(SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(s), &s, 0) == 0)

    {

        this->WriteError(

            wstr(L"CreateNullFont::SystemParametersInfo(SPI_GETNONCLIENTMETRICS) : %s",

            GetApiErrorString().c_str()));

        return false;

    }


    auto* font = this->_OnCreateFont(s.lfMessageFont, L"NullFont");

    if (!font)

        return false;


    m_rm->SetNullObject(*font);

    return true;

}



Posted by OOJJRS
,