title: AddFontMemResourceEx
body: <p>The following code should work to load a font from a binary resource stored in my executable to system memory according to all of the examples I have found but it is not working. "myfont" is the name of the ttf associated with IDR_FONT in the resource file.</p>
  
  <pre><code>    DWORD   Count ;
      HRSRC   Resource = FindResource(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_FONT),"BINARY") ;
      DWORD   Length   = SizeofResource(GetModuleHandle(NULL),Resource) ;
      HGLOBAL Address  = LoadResource(GetModuleHandle(NULL),Resource) ;
      HANDLE Handle = AddFontMemResourceEx(Address,Length,0,&amp;Count) ;
      if(Handle==0)
      {
          MessageBox(hWnd,"Font load failed", "Error",NULL);
      }
  
  
  
          LOGFONT logfont; //set window font
          logfont.lfCharSet = DEFAULT_CHARSET;
          logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
          logfont.lfEscapement = 0;
          memcpy(logfont.lfFaceName, "myfont", LF_FACESIZE); 
          logfont.lfHeight = 14; 
          logfont.lfItalic = FALSE; 
          logfont.lfOrientation = 0;
          logfont.lfOutPrecision = OUT_TT_PRECIS;
          logfont.lfQuality = PROOF_QUALITY;
          logfont.lfStrikeOut = FALSE;
          logfont.lfUnderline = FALSE;
          logfont.lfWeight = FW_DONTCARE; 
          hFont = CreateFontIndirect(&amp;logfont);
  </code></pre>
  
  <p>Any ideas what I am doing incorrectly?</p>