Main Program

The main program sets up the container window for the embedded browser and manages its events. By default, an Internet Explorer browser will be created. An Edge browser is created only if /edge is specified in the command line arguments.

The order of things in the main program is:

  • Create the container window.
  • Set the container window title.
  • Create the embedded browser window and attach it to the container.
  • Navigate to https://whatismybrowser.com.
  • Bring the container window to the foreground.
  • Enter the message loop.

When we come to complete the solution, we will replace the URL with the root page of our encrypted user interface. But at this stage, the URL chosen is useful as the site will indicate which browser it thinks is running.

The next step is to write the code to create the embedded browsers. To facilitate this, I defined an abstract class called CWebBrowser from which two concrete classes are created; one for Internet Explorer and the other for Edge.