The browsing seems to work fine, but when a page has an HTML input field and
I type into it, pressing the ENTER key seems to have no effect.
Does anyone know the reason for this, and what can be done about it? Any
help would be highly appreciated.
Thanks in advance.
Arka Roy
Please someone, if you know how to solve this problem, tell us!
More info (Arka: maybe you can relate?):
- I installed the TCppWebBrowser as an ActiveX component
- I did not at the time have a professional version of C++ Builder (5)
-Aaron
hth,
.a
Aaron Bockover wrote:
[snip]
Just letting you all know I finally found a solution to this problem. Here it is:
IN HEADER FILE
//////////////////////////////////////////////
__published:
TCppWebBrowser *CppWebBrowser1;
private:
void __fastcall MyMessageHandler(tagMSG &Msg, bool &Handled);
IOleInPlaceActiveObject *OleInPlaceActiveObject;
//--------------------------------------------
IN SOURCE FILE
//////////////////////////////////////////////
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Application->OnMessage = MyMessageHandler;
}
//--------------------------------------------
void __fastcall TForm1::MyMessageHandler(tagMSG &Msg, bool &Handled)
{
if( Msg.message == WM_RBUTTONDOWN || Msg.message == WM_RBUTTONDBLCLK )
Handled = true;
else if( CppWebBrowser1 &&
(Msg.message == WM_KEYDOWN || Msg.message == WM_KEYUP) &&
(Msg.wParam == VK_RETURN || Msg.wParam == VK_EXECUTE) )
{
Handled = IsDialogMessage(CppWebBrowser1->Handle, &Msg);
if (Handled)
{
if( !OleInPlaceActiveObject )
CppWebBrowser1->Application->QueryInterface( IID_IOleInPlaceActiveObject, (void **)&OleInPlaceActiveObject );
if( OleInPlaceActiveObject )
OleInPlaceActiveObject->TranslateAccelerator(&Msg);
}
}
else
Handled = false;
}
//--------------------------------------------
Additionally, I got another solution from Borland's support. I didn't use it because it would have been a big risky job to change components at this point in my schedule. Here it is for anyone who is interested. Since I didn't actually try it unfortunately I won't be able to answer any detailed questions you may have.
======= Borland-suggested solution
Use the THTML component instead of TCppWebBrowser. Please do the following to register the THTML component.
Import the C++Builder 4 NetMasters HTML.OCX
(located on the C++Builder 5 CD-ROM in Info\Extras\NetManage).
Install NetManage OCX components:
1. Copy the files Html.ocx, *.dll to the Windows\System directory.
2. Go to Component | Import ActiveX Control | Add
(Select HTML.OCX control)
3. Select the palette page as you wish (for example Internet)
4. Then Click Install and continue clicking OK or YES
if any dialog box appears
5. Then saves the changes to the project .
After this, the control will get automatically registered.
Now you can find HTML component in the Internet page.
-------------------------------------------
Note :
TCppWebBrowser wraps the IWebBrowser2 interface from Microsoft’s Shell Doc Object and Control Library (SHDOCVW.DLL) to allow you to create a customized Web browsing application.
But THTML component uses ActiveX from a 3rd party (Netmanage).
=======================================================