Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ COM C++/MFC
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):
 
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 12-Apr-13 4:25am
max_nowak1.4K
Edited 12-Apr-13 4:39am
v4

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 15 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100