编写应用程序消息

来源:互联网 发布:淘宝第三层级交易额 编辑:程序博客网 时间:2024/06/14 08:13

procedure AppOnMessage(var Msg: TMsg; var Handled: Boolean);


procedure Tfmformname.AppOnMessage(var Msg: TMsg; var Handled: Boolean);
var
    a:Cardinal;
    i: SmallInt;
    WMD: TWMDropFiles;
    buf :array[0..254] of Char;
begin
    if (Msg.message = WM_KEYDOWN) then
    begin
        //CTRL+S:  tig TEjunTreeGrid会相应这个消息,  让当前单元格处于全选编辑状态, 很蛋疼, 所以再次拦截消息
        if (GetKeyState(VK_CONTROL)<0) and (Msg.wParam=ord('S')) THEN
        begin
            
           。。。。
        end ELSE
        //为防止误操作,禁止热键Ctrl+左右方向键 进行升级 降级 操作
        if (GetKeyState(VK_CONTROL)<0) and ((Msg.wParam=VK_LEFT) or (Msg.wParam=VK_RIGHT)) THEN
        begin
            Handled:= true;
        end else
        //CTRL+F: 查找
        if (GetKeyState(VK_CONTROL)<0) and (Msg.wParam=ord('F')) then
        begin
            cbx_key.SetFocus;
            cbx_key.SelectAll;
            Handled:= true;
        END else
        //F3: 下一个(仅对当前查找有效)
        if (GetKeyState(VK_CONTROL)>=0) and (Msg.wParam=VK_F3) then
        begin
            FindNextEx();
            Handled:= true;
            //G.Log.WriteAppLog('F3: 下一个...', G.MainHanlde);
        END;


    end;
end;


procedure Tfm2fmname.FormCreate(Sender: TObject);
begin
    Application.OnMessage:= AppOnMessage;



0 0
原创粉丝点击