class CA : public IX, IY
{
public:
CComQIPtr<IFontDisp> m_spFont;
CComQIPtr<IZ> m_spZ;
}
//ca.cpp
HRESULT CA::FinalConstruct()
{
m_spZ.CoCreateInstance(CLSID_Z);
//如何初始化m_spFont呢?
}
4 个解决方案
#1
编译环境是vs2005,创建的是ATL组件
先谢谢了:)
先谢谢了:)
#2
CComPtr<IFont> p;
CComPtr<IFont> pFont;
if(SUCCEEDED(GetAmbientFont(&p)) && p)
if(SUCCEEDED(p->Clone(&pFont)) && pFont)
pFont->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
http://support.microsoft.com/kb/Q166472
That shows exactly how to use fonts in a ATL Control
CComPtr<IFont> pFont;
if(SUCCEEDED(GetAmbientFont(&p)) && p)
if(SUCCEEDED(p->Clone(&pFont)) && pFont)
pFont->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
http://support.microsoft.com/kb/Q166472
That shows exactly how to use fonts in a ATL Control
#3
thanks a lot!
this is my first quetion in this forum.
how to give you the score?
this is my first quetion in this forum.
how to give you the score?
#4
FONTDESC fd = _fontdesc;
CComPtr<IFont> pAF;
CComPtr<IFont> pClone;
if(SUCCEEDED(GetAmbientFont(&pAF)))
{
//clone the font
if(SUCCEEDED(pAF->Clone(&pClone)))
pClone->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
}
else
{
OleCreateFontIndirect(&fd,IID_IFontDisp,(void**)&m_pFont);
}
CComPtr<IFont> pAF;
CComPtr<IFont> pClone;
if(SUCCEEDED(GetAmbientFont(&pAF)))
{
//clone the font
if(SUCCEEDED(pAF->Clone(&pClone)))
pClone->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
}
else
{
OleCreateFontIndirect(&fd,IID_IFontDisp,(void**)&m_pFont);
}
#1
编译环境是vs2005,创建的是ATL组件
先谢谢了:)
先谢谢了:)
#2
CComPtr<IFont> p;
CComPtr<IFont> pFont;
if(SUCCEEDED(GetAmbientFont(&p)) && p)
if(SUCCEEDED(p->Clone(&pFont)) && pFont)
pFont->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
http://support.microsoft.com/kb/Q166472
That shows exactly how to use fonts in a ATL Control
CComPtr<IFont> pFont;
if(SUCCEEDED(GetAmbientFont(&p)) && p)
if(SUCCEEDED(p->Clone(&pFont)) && pFont)
pFont->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
http://support.microsoft.com/kb/Q166472
That shows exactly how to use fonts in a ATL Control
#3
thanks a lot!
this is my first quetion in this forum.
how to give you the score?
this is my first quetion in this forum.
how to give you the score?
#4
FONTDESC fd = _fontdesc;
CComPtr<IFont> pAF;
CComPtr<IFont> pClone;
if(SUCCEEDED(GetAmbientFont(&pAF)))
{
//clone the font
if(SUCCEEDED(pAF->Clone(&pClone)))
pClone->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
}
else
{
OleCreateFontIndirect(&fd,IID_IFontDisp,(void**)&m_pFont);
}
CComPtr<IFont> pAF;
CComPtr<IFont> pClone;
if(SUCCEEDED(GetAmbientFont(&pAF)))
{
//clone the font
if(SUCCEEDED(pAF->Clone(&pClone)))
pClone->QueryInterface(IID_IFontDisp, (void**)&m_pFont);
}
else
{
OleCreateFontIndirect(&fd,IID_IFontDisp,(void**)&m_pFont);
}