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.
The following version uses my OLE Container (OLECON.INC) instead of ATL.
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.
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)
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).
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.
Thanks Jose, that was the problem.
Now it works!