1

I have essentially the same problem like the one described in this question:

How to make TWebBrowser ignore accelerator chars of others controls?

So the TWebBrowser is in design mode and accelerator keys from TAction are executing associated action.

The solution was:

type
  TWebBrowser = class(SHDocVw.TWebBrowser)
    procedure CNChar(var Message: TWMChar); message CN_CHAR;
  end;

...

procedure TWebBrowser.CNChar(var Message: TWMChar);
begin
  Message.Result := 0;
end;

I'd like to try the solution described in the above question but I'm having trouble translating that into C++ Builder code. How do I translate - and - are there other solutions without descending TWebBrowser and overriding CNChar procedure (maybe doing it in the TForm based event)?

Coder12345
  • 3,431
  • 3
  • 33
  • 73

1 Answers1

0

Translation to C++ Builder (credit to Remy Lebeau).

class TWebBrowser : public Shdocvw::TWebBrowser
{
private:
    MESSAGE void __fastcall CNChar(TWMChar &Message);

public:
    inline __fastcall virtual TWebBrowser(TComponent* AOwner) : Shdocvw::TWebBrowser(AOwner) { }

BEGIN_MESSAGE_MAP
    VCL_MESSAGE_HANDLER(CN_CHAR, TWMChar, CNChar);
END_MESSAGE_MAP(Shdocvw::TWebBrowser)
};

...

void __fastcall TWebBrowser::CNChar(TWMChar &Message)
{
    Message.Result = 0;
}
Coder12345
  • 3,431
  • 3
  • 33
  • 73