Questioner1201

Hello,

I am trying to use CWebBrowser2 to view pages and it is all working fine. The problem is that all the buttons look 'old school'

I am currently using Windows XP and have modified my program which contains the IE component to have the Windows XP Look and feel; but for some reason, the internet explorer dialog within my program does not have the Windows XP Look. All the buttons are not rounded or shaded as in the rest of my program.

Is there any (easy) way for me to set the CWebBrowser2 to use the XP Look

Thanks


Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Sahir Shah

The appearance of the toolbar buttons is limited to what the control will allow. You can customise the toolbar to a certain extent. Please see http://msdn2.microsoft.com/en-us/library/aa753592.aspx for details. Try installing IE7 to see if you get a newer version of shdocvw.dll which may have a toolbar with a different appearance.

BTW, CWebBrowser2 is the default name of the wrapper class generated by the class wizard in VC6, using that name can be confusing to the reader. You can call it the Microsoft WebBrowser control or use the name of the interface IWebBrowser2.

Regards

Sahir Shah





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Questioner1201

My apologies,

I was actually referring to buttons that I had on the web page not the toolbar.


Thanks.




Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Sahir Shah

Questioner1201 wrote:
My apologies,

I was actually referring to buttons that I had on the web page not the toolbar.

The appearance of the web page (including the buttons on it ) will be as it is in your current browser. The appearance of the web page is largely controlled by what you put on it. The browser should not affect the appearance of the web page to a large extent unless you are using a really old version of IE like IE2 or IE3.

Regards

Sahir Shah





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Questioner1201

Hello,

I am using I.E. 6, and I would try the website on both the embedded browser and my internet explorer browser, and the web pages appear different. The difference is that the buttons on the webpage within the embedded browser are square and not shaded, while the buttons on the internet explorer browser have rounded corners and are shaded.

I wonder why they would be different...

Any help is greatly appreciated.

Thanks.





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Sahir Shah

Questioner1201 wrote:
I am using I.E. 6, and I would try the website on both the embedded browser and my internet explorer browser, and the web pages appear different. The difference is that the buttons on the webpage within the embedded browser are square and not shaded, while the buttons on the internet explorer browser have rounded corners and are shaded. .

I tried a few websites and I did not see any difference. If it's a public website please post the url or if it isn't try and find a public website where you can see any difference.





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Holger Grund

IDocHostUIHandler::GetHostInfo can return a flag to indicate it supports themes. I take it MFC implements that interface for you as part of CWebBrowser2. Just take a look at the MFC source to see what's fed into flags for the GetHostInfo implementation.

-hg





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Questioner1201

There is not a GetHostInfo method for the CWebBrowser2 class.

I also checked a public website like google and I noticed the problem.

Thanks





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Sahir Shah

Questioner1201 wrote:

I also checked a public website like google and I noticed the problem.

I tried looking at google.com in IE6 , in a web browser control in a VC6 application, in a web browser control in a VB6 application and finally in Firefox just to double check. I could not see any difference. The two buttons there have always been square and still are, the rest of the page looks the same to me. What is the difference you saw





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Sahir Shah

Got the picture in the mail. I see what you mean now. I couldn't see any difference earlier because I was using the "Windows Classic" theme. Shall investigate IDocHostUIHandler angle and revert.

Regards

Sahir Shah





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Holger Grund

Ah, I assumed CWebBrowser2 is an MFC provided class. I take it, it's simply generated from the type library.

In ActiveX, there's the host and hosted component. In your case your application is the host (Internet Explorer is another host application) and the WebBrowser control is the hosted component. The container register itself with the hosted component. The component can the query the services it needs to communicate with the host. This is all documented quite well for the standard case, but I have to look things up for MFC.

Ok, in MFC you override CreateControlSite to return a Control Site that implements IDocHostUIHandler. Fortunately, an implementation already exists to support CDHtmlDialog (BTW: are you sure you cannot use that ).

You can implement a class much like CBrowserControlSite. GetHostInfo is in there.

-hg





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Questioner1201

Your reply seems helpful but I am just a beginner. Is there any way you can supply me with the code necessary

Like, what do I put in the function I override in CWebBrowser2:

BOOL CreateControlSite(COleControlContainer *pContainer, COleControlSite **ppSite, UINT nID, const CLSID &clsid)

{ }

Also, since the Control Site Necessary is just to change the Theme of the Browser, could you provide that code I don't know what I need for it.

Thanks again.





Re: Visual C++ General How can I Get an XP Look for CWebBrowser2?

Sahir Shah

Here is an article about implementing the same interface for a different purpose

http://www.codeproject.com/miscctrl/WBCArticle.asp

Please see the attached sample. What you need to do differently is :

Code Snippet


HRESULT FAR EXPORT CCustomControlSite::XDocHostUIHandler::GetHostInfo( DOCHOSTUIINFO* pInfo ) {

pInfo->dwFlags = 0x00040000;
return S_OK;
}

Please see

http://msdn2.microsoft.com/en-us/library/aa753257.aspx

and

http://msdn2.microsoft.com/en-us/library/aa753277.aspx