if GetAsyncKeyState(VK_LButton)<>0 then
dothing;这个是按下左键,那如果要按下左键并放开才做事..改怎么写这个函数?.我写的这个是个鼠标钩子的服务端程序.请问各位大师级别的有什么函数判断?谁告诉我,100分全部相赠.

解决方案 »

  1.   

    你说的应该是鼠标单击事件,通过获取虚拟码的功能可能实现不了,为什么不再onclick()事件里写那些代码呢
      

  2.   

    直接用消息钩子WH_GETMESSAGE监控WM_LBUTTONUP试试,一会写一个试试!
      

  3.   

    用消息钩子倒是可以实现,简单写了一个测试了下。
    如果必须用鼠标钩子,那就再琢磨琢磨,呵呵var
      h: THandle;
      m: PMSG;  procedure EnableHook; export;
      procedure DisableHook; export;
      function GetMsgProc(code: integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;implementationprocedure EnableHook; export;
    begin
      h:= SetWindowsHookEx(WH_GETMESSAGE,@GetMsgProc,HInstance,0);
    end;procedure DisableHook; export;
    begin
      UnhookWindowsHookEx(h);
    end;function GetMsgProc(code: integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
    begin
      result:= 0;
      if code < 0 then
      begin
        result:= CallNextHookEx(h,code,wParam,lParam);
        exit;
      end
      else
      begin
        if code = HC_ACTION then
        begin
          m:= PMSG(lParam);
          if m^.message = WM_LBUTTONUP then showmessage('LBUTTONDOWN');
        end;
      end;
    end;