Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
4.53/5 (3 votes)
See more:
Hi codeproject community,

normally I never bother an internet forum with my problems but I am kind of desperated right now.
So here's the issue:

I have an MFC application with an webbrowser control in the gui contained. For this purpose I created a new class deriving from the necessary com interfaces to cope with all requirements. By now it more or less works pretty good, the only problem I'm still encountering is that I can't zoom or rather alter the font size inside the html control.

As usually I looked up the msdn documentation and came up with this code snippet (which ought to work according to the general consensus on the internet):

C++
VARIANT vFontSize;
VariantInit (&vFontSize);
V_VT(&vFontSize) = VT_I4;
V_I4(&vFontSize) = 4;   //arbitrary picked zoom value out of a possible range from 0 to 4
//m_pBrowser->ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, &vFontSize, NULL);
//EDIT:
m_pBrowser->ExecWB(OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &vFontSize, NULL);


But no matter what I try, there's not any change of the displayed html content.

Anyone got an idea?
Posted
Updated 12-Apr-13 3:39am
v4

1 solution

If anybody is interested, here's what I did to solve this:

Since the method to do it by calling the ExecWB function with the respective arguments still not want to work, I did a somewhat ugly work around.

On the OnDocumentComplete event, I simply call a Javascript function which does the zoom for me. This manual was of very big help for me. Thanks again Mr. Khodakovsky.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900