问题一:如何HOOK住WM_NCHITTEST消息,安装什么类型的钩子?我试过WH_GETMESSAGE,WH_MOUSE都不行啊问题二,如何知道光标的位置(不是鼠标),不要用GetCaretPos,因为不是输入文本时用的谢谢

解决方案 »

  1.   

    WH_MOUSE不行吗,要不试试声明一个函数:
    在private部分加入下列代码:
    procedure wmnchittest(var msg:twmnchittest);
    message wm_nchittest;
    在程序部分加入以下代码:
    procedure TForm1.wmnchittest(var msg:twmnchittest);
    begin
    inherited;
    if (htclient=msg.result) then msg.result:=htcaption;
    end;
    问题2:不输入文本会有光标吗
      

  2.   

    如果是本程序的話, 可用上面的方法, 如果是其它程序的話, 可試試 WH_MSGFILTER
      

  3.   


    声明:
    protected
        procedure WndProc(var Msg: TMessage); override;//Responding URL实现:
    procedure TMessageForm.WndProc(var Msg: TMessage);
    var
      x, y: integer;
      p: TPoint;
    begin
      GetCursorPos(p);
      x := p.x;
      y := p.y;
      case Msg.Msg of
        WM_NCHITTEST:
        begin
         // 加入要实现的代码
        end;
      end;   
      inherited;
    end;