COM と font


LPFONTDISP pOleFont = NULL;

FONTDESC fd;
fd.cbSizeofstruct = sizeof(FONTDESC);
fd.lpstrName = L"MS ゴシック"; //T2OLE("MS ゴシック");
fd.sWeight = 400;
fd.sCharset = SHIFTJIS_CHARSET;
fd.fItalic = 0;
fd.fUnderline = 0;
fd.fStrikethrough = 0;
fd.cySize.Lo = 22 * 100000;
fd.cySize.Hi = 0;

if (FAILED(::OleCreateFontIndirect(&fd, IID_IFontDisp, (void**)&pOleFont)))
{
  pOleFont = NULL;
  return;
}

pComm->PutFont(pOleFont);

//これでフォント変更できるようになる
pComm->PutFont(NULL);
pOleFont->Release();

VS-View


VC覚書きページ...