首先,在主窗体中声明以下private过程:
procedure TMainForm.DoEnterAsTab(var Msg: TMsg; var Handled: Boolean);
begin
if Msg.Message = WM_KEYDOWN then
begin
if Msg.wParam = VK_RETURN then
Keybd_event(VK_TAB, 0, 0, 0);
end; //if
end;
在主窗体的OnCreate事件中加入:
Application.OnMessage := DoEnterAsTab;