if wparam=111 then
begin
wparam=96 ;
result:=0;
end;  ??

解决方案 »

  1.   

    type
      TForm1 = class(TForm)
        Edit1: TEdit;
        procedure Edit1KeyDown(Sender: TObject; var Key: Word;
          Shift: TShiftState);
        procedure Edit1KeyPress(Sender: TObject; var Key: Char);
      private
        { Private declarations }
        m_bNot: Boolean;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if (Key = VK_DIVIDE) and (Shift = []) then
        m_bNot := True;
    end;procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
      if m_bNot then
      begin
        Key := '0';
        m_bNot := False;
      end;
    end;end.
      

  2.   

    我不是想在我的程序中用,而是在其他地方例如Excel中使用!所以我想到了Hook!
      

  3.   

    我可以给你一个HOOK的例子. E: [email protected]
      

  4.   

    我用如下方法可解决,但觉得不爽
    if wparam=111 then
      if lparam>0 then
      begin
        keybd_event(96,0,0,0);
       result:=1;
      end;
      

  5.   

    上面的代码不够爽,能否在hook中改变消息的参数!