Active Form 按键无效???(100分)

  • 主题发起人 主题发起人 cq_139
  • 开始时间 开始时间
C

cq_139

Unregistered / Unconfirmed
GUEST, unregistred user!
Active Form 按键无效,有什么办法解决??
例如:Backspace 键
 
你要点击一下ActiveForm的能接受焦点的控件,如Edit.
http://www.delphibbs.com/delphibbs/dispq.asp?lid=475005
http://www.delphibbs.com/delphibbs/dispq.asp?lid=516666
http://www.delphibbs.com/delphibbs/dispq.asp?lid=157837
 
现在我Backspace键可以用,但是Enter键失效了,代码如下:
var
iOIPAO: IOleInPlaceActiveObject;
Dispatch: IDispatch;
begin
{ exit if we don't get back a webbrowser object }
if WebBrowser1 = nil then
begin
Handled := False;
Exit;
end;
Handled:=(IsDialogMessage(WebBrowser1.Handle, Msg) = True);
//此句是关键,问题是用后Enter键失效,去掉这句Backspace键失效,为什么????
if (Handled) and (not WebBrowser1.Busy) then
begin
if FOleInPlaceActiveObject = nil then
begin
Dispatch := WebBrowser1.Application;
if Dispatch <> nil then
begin
Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO);
if iOIPAO <> nil then
FOleInPlaceActiveObject := iOIPAO;
end;
end;

if FOleInPlaceActiveObject <> nil then
if //((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP))
((Msg.message >= WM_KEYFIRST) and (Msg.message <=WM_KEYLAST))
and
((Msg.wParam = VK_BACK) or (Msg.wParam = VK_LEFT)
or (Msg.wParam = VK_RIGHT) or(Msg.wParam = VK_TAB) or (Msg.wParam = VK_RETURN)) then
//either write a message handler for the particular message or do
//nothing - do not pass on Backspace, Left or Right arrows or tab
else
FOleInPlaceActiveObject.TranslateAccelerator(Msg);
end;
end;
 
请高手指点,我的是Delphi7!
 
高手在哪???
我开始是没有Backspace键,加了上面的的代码后,就没有了Enter,Delphi7真他妈的恶心!
 

Similar threads

回复
0
查看
877
不得闲
回复
0
查看
867
不得闲
S
回复
0
查看
850
SUNSTONE的Delphi笔记
S
后退
顶部