Implementing the "Font" feature like the one in INTERNET EXPLORER
Posted
by Sriram Srinivasan
on August 7th, 1998
A sample code to change the fonts in your web browser using webbrowser control.
void CMyBrowser::SetFont(int nFontSize)
{ m_pDisp = NULL; // IDISPATCH pointer
LPOLECOMMANDTARGET pCmdTarg = NULL;
m_pDisp = m_WebBrowser2.GetDocument(); // get the idispatch pointer from webbrowser control
ASSERT(m_pDisp); //check for validity
m_pDisp->QueryInterface(IID_IOleCommandTarget, (LPVOID*)&pCmdTarg); //query for IID_IOleCommandTarget interface
ASSERT(pCmdTarg); // check for validity
VARIANT vaFontSize; // input argumentsVariantInit(&vaFontSize);
V_VT(&vaFontSize) = VT_I4;
V_I4(&vaFontSize) = nFontSize; //size of the font you want
VARIANT vaFontOutput;
pCmdTarg->Exec(NULL, // execute just change the font
OLECMDID_ZOOM,
OLECMDEXECOPT_PROMPTUSER,
&vaFontSize,
&vaFontOutput);
VariantClear(&vaFontSize); //clear the variant variable before freeing its memory
if (pCmdTarg) pCmdTarg->Release(); // release document's command target
if (m_pDisp) m_pDisp->Release(); // release document's dispatch interface
}
Updated on May 18 1998

Comments
How to set face name ...
Posted by Legacy on 05/04/2002 12:00amOriginally posted by: anhthu
It just set text size. Do you know how to set font face name ???
ReplyHow to intercept the contents of Homepage before showing in the IE browser without proxy?
Posted by Legacy on 02/20/2001 12:00amOriginally posted by: Yung-Ming Kuo
Dear friends:
I want to intercept and get the contents(including text and image) of homepage from Web server ,before it shows the IE browser(version 5.0).But it is not through proxy.
And i have ability to prevent HTML document from showing the browser.
Could you offer some suggestion or source code sample to solve my question?
Thank you ^_^
email:ymkuo@neural.ee.ncku.edu.tw
by Kuo
Replydoubt
Posted by Legacy on 01/28/2000 12:00amOriginally posted by: shri
In which language is the above code put up in??
Replyshri.
request
Posted by Legacy on 07/31/1999 12:00amOriginally posted by: manoj
thanking you
Manoj@mca.vec.ac.in
ReplyManoj+
how to make it with vb5 ?
Posted by Legacy on 06/28/1999 12:00amOriginally posted by: Luca
how to make it with vb5 ? :)
ReplyHow to do menu ticks!
Posted by Legacy on 05/06/1999 12:00amOriginally posted by: uniken
ReplyDots?
Posted by Legacy on 03/09/1999 12:00amOriginally posted by: Chris
How do you get the radio buttons to show on the menu which shows the current selected size like in IE?
ReplyGood
Posted by Legacy on 09/30/1998 12:00amOriginally posted by: Sriram
Its a good article.
Reply