问题描述
我在本质上与该问题中所述的问题相同:
I have essentially the same problem like the one described in this question:
所以 TWebBrowser
处于设计模式, TAction
的加速键正在执行关联的操作。
So the TWebBrowser
is in design mode and accelerator keys from TAction
are executing associated action.
解决方案是:
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;
我想尝试上述问题中描述的解决方案,但在将其转换为C ++ Builder代码时遇到麻烦。我该如何翻译-还有-还有其他解决方案,而不必降低 TWebBrowser
并覆盖 CNChar
过程(也许是在 TForm
事件)?
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)?
推荐答案
翻译为C ++ Builder(贷给Remy Lebeau)。
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;
}
这篇关于如何在TWebBrowser中忽略加速器字符(设计模式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!