Jose's Read Only Forum 2023

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Source Code => Web Development => WebBrowser Control and MSHTML => Topic started by: José Roca on September 23, 2008, 09:08:56 PM

Title: Mini WebBrowser
Post by: José Roca on September 23, 2008, 09:08:56 PM
 
The following example demonstrates how to embed the WebBrowser control, using ATL.DLL as the OLE container, and implement features like navigation, find, print preview, page setup, print, properties, save, and cancellation of the creation of new windows.
Title: Re: Mini WebBrowser
Post by: José Roca on December 05, 2008, 02:52:50 PM
 
The following version uses my OLE Container (OLECON.INC) instead of ATL.
Title: Re: Mini WebBrowser
Post by: Randall Glass on September 05, 2012, 06:39:26 AM
I really like this  OLE browser.

The best browser on your site.

How would you get it to bring up a web page, when it starts.
Title: Re: Mini WebBrowser
Post by: José Roca on September 05, 2012, 06:10:20 PM
The easiest way is to add the following code before pWindow.DoEvents(nCmdShow):


   LOCAL hUrlTextbox AS DWORD
   hUrlTextbox = GetDlgItem(GetDlgItem(pWindow.hwnd, %IDC_REBAR), %IDC_EDITURL)
   SetWindowText hUrlTextbox, "http://www.powerbasic.com/support/pbforums/"  ' <-- change me
   PostMessage pWindow.hwnd, %WM_COMMAND, %IDC_GOBTN, MAK(DWORD, %BN_CLICKED, %IDC_GOBTN)

Title: Re: Mini WebBrowser
Post by: Theo Gottwald on September 05, 2012, 08:51:23 PM
I have compiled the browser in both versions, the controls in the upper left corner seem not to be working reliable.
Sometimes they disappear completely. Then they are only visible half (see attached picture).
Title: Re: Mini WebBrowser
Post by: José Roca on September 05, 2012, 11:08:09 PM
If you're going to compile legacy code with new headers, then specify the version you want to use. Add %WINVER = &H0501 before the #INCLUDEs. The size of the REBARBANDINFO structure is not the same for XP that for Vista/Windows 7.
Title: Re: Mini WebBrowser
Post by: Theo Gottwald on September 06, 2012, 09:29:54 AM
Thanks Jose, that was the problem.
Now it works!