Click here to Skip to main content
11,710,472 members (89,290 online)
Click here to Skip to main content

Donut, A WTL sample - Hosting WebBrowser Control

, 15 Nov 2001 281.5K 2.6K 80
Rate this:
Please Sign up or sign in to vote.
MDI and Tabbed WebBrowser

Sample Image

Preface

Welcome to Donut2. Donut grows up to the practical application. I have resolved many problems, which involved even a bug of CString, for this year. WTL lacks: the way to serialize application general settings, to serialize Rebar-Bands states, to serialize Toolbar states, to ordering of ToolBar buttons, and to load 8bit bitmap Toolbar images, and the implementation of the reliable CommandBar, OLE-drag-drop, and Update-Command-UI. All is the foundamentals for your applications. So I had to write many drafts for them, and I have reached and published almost good one. Before you play your own role, check that codes.

Features

  • Supports most of all Microsoft Internet Explorer supports
  • Controls downloading image, running scripts and so on
  • Switches active MDI child windows by Tab control
  • Deters advertising popup windows
  • Supports Favorite Group
  • Tab control supports OLE-drag-and-drop
  • Supports the loading of Favorites' order
  • You can try Mozilla control

Source code guide

  • ATL3.0 doesn't support put_DLControlFlags which controls downloading images etc, so I have Changed Atlhost.h a little. You need not to read AtlhostEx.h, AtlifaceEx.h, AtlifaceEx.idl, and AtlifaceEx_i.c.
  • Many users hope an application not use "Registry", so I wrote MtlProfile.h for "Ini file", in which algorithms support ATL::CRegKey, too. And you can find functions which save and load ReBar Bands' position.
  • In ExplorerMenu.h, Emulates IE's "Favorites Menu" which loads your Favorites dynamically.
  • As WTL::CCommandBarCtrl doesn't support MenuControl (Nobody finds MDI application with a command bar on rebar), I wrote MDIMenuControl.h.
  • In MtlWeb.h or MtlMisc.h you can find some utility functions. Some SHx APIs require the infamous "Active Desktop", so I had to write some codes instead of them.
  • If a SDI application, WTL::UpdateUI frame work is not bad. But if a MDI application, I think it useless. So I wrote CUpdateCmdUI.h from MFC's UpdateCommandUI framework.
  • If the file name is Mtlx.h, I think it reusable. If not, it's a draft header.

Problems

  • While switching the active maximized MDI child window, you can take a look at normal-sized window.
  • If you activate other window before page loading is completed, then WebBrowser control will lose a focus every page you go.
  • If a link decides target frame, "Window Lock" is not effective.
  • As I forcefully narrow the vertical gap of rebar in a menubar and toolbar band, if you change the position of toolbar bands, top and bottom of toolbar pressed buttons can't be painted.
  • If IE4, then you can't load Donut. Can you fix it?
  • It seems that SetWindowText API sometimes crashes. Somebody fix it!

Warning

  • Donut needs WTL3.1 and the latest SDK headers.
  • Donut doesn't use C-Runtime Library(CRT) according to WTL. (But it depends on the STL implementation. If HP's STL, it's ok. If SGI's STL, CRT required). If you determine whether to use CRT or not, you'd better use it! I guess that in Donut, which is not so large, the amout of code of tricks for avoidance of CRT is now more than CRT set-up codes.
  • If you build it in Release mode, the compiler would warn that Exception is invalid, but don't care.
  • Fonts of Dialog resources is "MS UI Gothic". So if you don't have this font, it's possible the dialog layout may go mad.
  • As I don't have English version of Microsoft Internet Explorer, All the menu texts is not same as that.
  • Favorite Group files are searched in the path \folder has Donut.exe\FavoriteGroup\. Please make FavoriteGroup folder.

Comment

  • Simple wrapper classes such as CWindow feel good. MFC tries to control a life of a window and often makes trouble.
  • Even if you write wrong codes, the access violation may not occur. I think HWND is even more safe than CWnd*.
  • WTL's message map is very flexible, so you can write codes much more easily than MFC in some cases.
  • CCommandBarCtrl is big one, but I think the function of displaying icons must be separated from command bar in order to smallize a code size, because I think many developers want only command bar.
  • About WTL's rebar framework, I have some complaints.
  • While developing it, I've found some bugs, you can check it out here, where you may still find bugs.

WTL or MFC

Donut now means "Why Don't you use WTL?". Even if you do a job with WTL, you will not think it useless, while you shares Donut source codes. WTL makes a use of the bare functionalities of Windows APIs, which is absolutely object-oriented (Do you believe it?). That's why WTL has the crucial advantage - the smallest and fastest code, that I think the reason why you choose C++. Now that the new programming paradigm is coming, you are trying to write codes in generic way: Concept-based, Policy-based programming, that is, template magics, almost of which VC6 can't cast. I believe WTL considerably will fit it.

Words of thanks

Special thanks to those who help me cook Donut, especially Dog-store, fub and Nishizawa. you can find them in the source code.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

MB
Japan Japan
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralWebbrowser by Visual studio .net 2005 Pin
Vishnu K B2-Nov-08 1:50
memberVishnu K B2-Nov-08 1:50 
GeneralRe: Webbrowser by Visual studio .net 2005 Pin
mbaocha6-May-09 16:50
membermbaocha6-May-09 16:50 
QuestionHow can i add more than one rich text box in one desktop application (different tabs) Pin
Vishnu K B2-Nov-08 1:47
memberVishnu K B2-Nov-08 1:47 
GeneralDonut.rc(10) : fatal error RC1015: cannot open include file 'atlres.h'. Pin
K.O.26-Jul-08 22:51
memberK.O.26-Jul-08 22:51 
QuestionControlling Sidebar from BHO Pin
Alex Shneyder9-Oct-07 17:15
memberAlex Shneyder9-Oct-07 17:15 
GeneralUpdateCmdUI implementation is great Pin
kaddiexjc3-Apr-05 22:56
memberkaddiexjc3-Apr-05 22:56 
Generalproblems with mtlweb.h Pin
nihoninu13-May-04 19:34
membernihoninu13-May-04 19:34 
GeneralDonutin' alive Pin
MB23-Jan-03 10:29
memberMB23-Jan-03 10:29 
Generalcompiling error: Pin
conquestjy8-Jan-03 21:44
memberconquestjy8-Jan-03 21:44 
GeneralRe: compiling error: Pin
zerhart10-Jan-03 5:19
memberzerhart10-Jan-03 5:19 
GeneralRe: compiling error: Pin
conquestjy14-Jan-03 21:42
memberconquestjy14-Jan-03 21:42 
GeneralRe: compiling error: Pin
RAPT23-Jan-03 4:20
sussRAPT23-Jan-03 4:20 
GeneralRe: compiling error: Pin
jerrycgl8-Jun-03 22:35
memberjerrycgl8-Jun-03 22:35 
QuestionHow to use WebBrowser in dialog? Pin
marco.song15-Dec-02 4:25
membermarco.song15-Dec-02 4:25 
Generalshow up a exception Pin
marco.song15-Dec-02 3:47
membermarco.song15-Dec-02 3:47 
Generalcompiling error Pin
hibiki197918-Nov-02 14:37
memberhibiki197918-Nov-02 14:37 
GeneralRe: compiling error Pin
Hp1218-Nov-02 23:41
memberHp1218-Nov-02 23:41 
GeneralDoes not love WTL7 Pin
Anonymous27-Jun-02 10:04
memberAnonymous27-Jun-02 10:04 
GeneralTabbing issue Pin
Anonymous15-Jun-02 20:30
memberAnonymous15-Jun-02 20:30 
GeneralCompile Error Pin
AlexT13-Jun-02 1:01
memberAlexT13-Jun-02 1:01 
GeneralRe: Compile Error Pin
MBMB13-Jun-02 23:22
memberMBMB13-Jun-02 23:22 
GeneralMozilla Control Integration Pin
Frank Sowinski16-Apr-02 1:42
memberFrank Sowinski16-Apr-02 1:42 
GeneralRe: Mozilla Control Integration Pin
MBMB16-Apr-02 3:27
memberMBMB16-Apr-02 3:27 
GeneralRe: Mozilla Control Integration Pin
Frank Sowinski17-Apr-02 2:18
memberFrank Sowinski17-Apr-02 2:18 
GeneralRe: Mozilla Control Integration Pin
MBMB17-Apr-02 5:22
memberMBMB17-Apr-02 5:22 
GeneralLink Error Pin
kcjayhawk2-Apr-02 17:52
memberkcjayhawk2-Apr-02 17:52 
GeneralRe: Link Error Pin
MBMB4-Apr-02 23:11
memberMBMB4-Apr-02 23:11 
Questionhow to use function "internetsetoption" Pin
benben15-Mar-02 21:07
memberbenben15-Mar-02 21:07 
AnswerRe: how to use function "internetsetoption" Pin
MBMB15-Mar-02 22:38
memberMBMB15-Mar-02 22:38 
Questionhow to let the menu support OLE-drag-and-drop Pin
aaaHHH26-Dec-01 4:11
memberaaaHHH26-Dec-01 4:11 
AnswerRe: how to let the menu support OLE-drag-and-drop Pin
MB27-Dec-01 18:01
memberMB27-Dec-01 18:01 
GeneralRe: how to let the menu support OLE-drag-and-drop Pin
aaaHHH13-Jan-02 21:32
memberaaaHHH13-Jan-02 21:32 
GeneralRe: how to let the menu support OLE-drag-and-drop Pin
MB14-Jan-02 18:00
memberMB14-Jan-02 18:00 
QuestionHow to Handle popup window in custom browser Pin
coolvcguy17-Dec-01 18:42
membercoolvcguy17-Dec-01 18:42 
AnswerRe: How to Handle popup window in custom browser Pin
MB19-Dec-01 11:58
memberMB19-Dec-01 11:58 
Generalerror compiling Pin
[ pomj ]5-Dec-01 12:20
member[ pomj ]5-Dec-01 12:20 
GeneralRe: error compiling Pin
MB6-Dec-01 9:48
memberMB6-Dec-01 9:48 
GeneralRe: error compiling Pin
[ pomj ]7-Dec-01 10:31
member[ pomj ]7-Dec-01 10:31 
GeneralRe: error compiling Pin
MB8-Dec-01 9:10
memberMB8-Dec-01 9:10 
GeneralA question about HTML filter Pin
Leo Wang27-Nov-01 5:06
memberLeo Wang27-Nov-01 5:06 
GeneralRe: A question about HTML filter Pin
MB27-Nov-01 7:59
memberMB27-Nov-01 7:59 
GeneralClipboard Bug Pin
Leo Wang21-Nov-01 2:23
memberLeo Wang21-Nov-01 2:23 
GeneralRe: Clipboard Bug Pin
MB22-Nov-01 3:26
memberMB22-Nov-01 3:26 
GeneralConstant not found Pin
Leo Wang18-Nov-01 2:00
memberLeo Wang18-Nov-01 2:00 
GeneralRe: Constant not found Pin
MB18-Nov-01 4:09
memberMB18-Nov-01 4:09 
GeneralCompile Error() Pin
ls16-Nov-01 18:51
memberls16-Nov-01 18:51 
GeneralRe: Compile Error() Pin
Darren Schroeder17-Nov-01 2:24
memberDarren Schroeder17-Nov-01 2:24 
GeneralRe: Compile Error() Pin
MB17-Nov-01 2:55
memberMB17-Nov-01 2:55 
QuestionNew Version? Pin
Darren Schroeder15-Sep-01 15:04
memberDarren Schroeder15-Sep-01 15:04 
GeneralCompile Error(altres.h not found) Pin
Maria Jothi16-Jun-01 2:58
memberMaria Jothi16-Jun-01 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150819.1 | Last Updated 16 Nov 2001
Article Copyright 2000 by MB
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid