vendredi 22 septembre 2017

::Create font return Invalid Handler X64 bit

I am using visual studio 2017 update 15.3. i have compile the following code but get invalid font handle . return HFONT handle as 0xffffffff045875ca;

#include "stdafx.h"
#include "afxwin.h"
#include "Windows.h"

int main()
{
    CFont font;
    LOGFONT lf;
    memset(&lf, 0, sizeof(LOGFONT));       // zero out structure
    lf.lfHeight = 12;                      // request a 12-pixel-height font
    _tcsncpy_s(lf.lfFaceName, LF_FACESIZE,
        _T("Arial"), 7);                    // request a face name "Arial"
    HFONT hFont = CreateFontIndirect(&lf);
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire