GARANTIR DESCONTO

Fórum Erro com a procedure AppMessage #343437

19/07/2007

0

Ola pessoal criei essa procedure para controlar as teclas enter/ down e up, só que estou tendo problemas com algumas maquina com windows XP o estranho é que em algumas maquina com o mesmo windows XP funciona perfeitamente e em outros não, alguma luz?


procedure TFrmMenuPri.FormCreate(Sender: TObject);
begin
// Algumas instruções antes
Application.OnMessage := AppMessage;
end;

procedure TFrmMenuPri.AppMessage( var Msg:TMsg; var Handled:Boolean );
var A : String;
begin
lEnter := ( ( Msg.wParam = VK_RETURN ) or ( Msg.wParam = VK_TAB ) ) ;
if not ( ( Screen.ActiveControl is TCustomMemo ) or ( Contem( Screen.ActiveControl.ClassName, ´@TButton@TBitBtn@TListBox@´ ) ) or
( Screen.ActiveControl is TCustomDbGrid ) or ( Screen.ActiveControl.Name = ´EdBusca´ ) or
( Screen.ActiveControl is TCustomGrid ) ) and
( Msg.message = WM_KEYDOWN ) and ( Msg.wParam = VK_RETURN ) then
begin
//A:= Screen.ActiveControl.ClassName;
Screen.ActiveForm.Perform(WM_NEXTDLGCTL, 0, 0);
lEnter := True;
Handled := True;
end
else if not ( ( Screen.ActiveControl is TCustomComboBox ) or ( Screen.ActiveControl is TCustomGrid ) or
( Screen.ActiveControl is TCustomDbGrid ) or ( Screen.ActiveControl is TCustomMemo ) or
( Contem( Screen.ActiveControl.ClassName, ´@TGroupButton@TDBLookupComboBox@TDirectoryListBox@TListBox@´ ) ) or
( Screen.ActiveForm.ClassName = ´TMessageForm´) ) then //or ( Screen.ActiveControl.Name = ´EdBusca´ ) ) then
begin
if ( Msg.message = WM_KEYDOWN ) and ( Msg.wParam in [ VK_UP, VK_DOWN ] ) then
begin
A:= Screen.ActiveControl.ClassName;
if Msg.wParam = VK_UP then
Screen.ActiveForm.Perform(WM_NEXTDLGCTL, 1, 0)
else
Screen.ActiveForm.Perform(WM_NEXTDLGCTL, 0, 0);
Handled := True;
lEnter := False;
end;
end;
end;


Helderjr

Helderjr

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar