怎样抓取当前鼠标形状:

解决方案 »

  1.   

    鼠标的形状??是鼠标的指针吧??用GetCursor
      

  2.   

    或者你先Load一个Icon,将他的Handle传给GetIconInfo这个API来获得更加详细的资料
      

  3.   

    先用image edit做一个鼠标。用上面的api调用就ok 了 ,给你个例子先
       const
        crhehe=1;
    implementation{$R *.dfm}
     {$R BIT.res}
      {$R CUR.res}
    procedure TForm1.Button4Click(Sender: TObject);
    begin
    screen.Cursors[crhehe]:=loadcursor(Hinstance,'CUR');
    screen.Cursor:=crhehe;
    end;
      

  4.   

    先定义一个cursor变量:
    var GlobalCur:TIcon;
        windowhld:hwnd;
        threadld:dword;
    begin
      windowhld:=GetForegroundWindow;
      threadld:=GetWindowThreadProcessId(Windowhld,nil);
      AttachThreadInput(GetCurrentThreadId,threadld,true);
      GlobalCur:=TIcon.Create;
      GlobalCur.handle:=GetCursor;
      AttachThreadInput(GetCurrentThreadId,threadld,false);
    然后
    bitmap.canvas.brush.Style:=bsclear;
    bitmap.canvas.draw(x,y,GlobalCur); //x,y的值可以通过GetCursorPos得到
      

  5.   

    procedure TForm1.Timer1Timer(Sender: TObject);
    var ico:Ticon;
        hld:hwnd;
        threadld:dword;
        mp:tpoint;
    begin
      getcursorpos(mp);
      canvas.FillRect(rect(0,0,32,32));
      hld:=Windowfrompoint(mp);
      threadld:=GetWindowThreadProcessId(hld,nil);
      AttachThreadInput(GetCurrentThreadId,threadld,true);
      ico:=ticon.Create;
      ico.Handle:=getcursor;
      AttachThreadInput(GetCurrentThreadId,threadld,false);
      canvas.Draw(0,0,ico);
      ico.free;
    end;