Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disable just my mouse

Posted on 2002-06-17
8
Medium Priority
?
147 Views
Last Modified: 2010-04-04
I know how to disable the keyboard & the mouse.
But how can I disable just the mouse ? I wish to move my cursor through codes so if the user move the mouse I get an uggly effect.
0
Comment
Question by:ginsonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Expert Comment

by:333
ID: 7086003
and how you disable keyboard & mouse? are you using hooks or something else?
0
 
LVL 17

Expert Comment

by:geobul
ID: 7086241
Hi,
Perhaps hiding the mouse cursor is a solution.

procedure TForm1.Button1Click(Sender: TObject);
begin
  Screen.Cursor := crNone;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Screen.Cursor := crDefault;
end;

If it's not then:

procedure TForm1.CursorMoveToAndClip(cx,cy: integer);
var
  x,y: integer;
  p: TPoint;
  r: TRect;
begin
  ClipCursor(nil);
  p.x := cx;
  p.y := cy;
  p := Form1.ClientToScreen(p);
  SetCursorPos(p.x, p.y);
  r.TopLeft := p;
  r.BottomRight := p;
  ClipCursor(@r);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  CursorMoveToAndClip(10, 10);
  Sleep(2000);
  CursorMoveToAndClip(Form1.ClientWidth - 10, ClientHeight - 10);
end;

// and finally release the cursor
procedure TForm1.Button4Click(Sender: TObject);
begin
  ClipCursor(nil);
end;

Regards, Geo
0
 
LVL 6

Expert Comment

by:edey
ID: 7089923
you'd also want to unclip this cursor in your main form's onclose or perhaps in your project files after the Application.Run; , just to make sure that it's called before your app exits.

GL
Mike
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:ginsonic
ID: 7090202
No way . I create an animation movement so the cursor can't be hidden .
This is the ideea . When I make the animation and the user move the mouse I get an uggly effect :(
0
 
LVL 6

Expert Comment

by:edey
ID: 7091021
or just clip the cursor to a really small rect

GL
Mike
0
 
LVL 17

Accepted Solution

by:
geobul earned 400 total points
ID: 7091849
ginsonic,
please read my comment again (especially its second part).

Regards, Geo
0
 
LVL 6

Expert Comment

by:edey
ID: 7091869
and you can with clipcursor, check this :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
   r : TRect;
begin
     r.Left := (screen.width div 2)+round(cos(3.14159265*tag/180)*(screen.width div 2));
     r.top := (screen.height div 2)+round(sin(3.14159265*tag/180)*(screen.height div 2));
     r.Right := r.Left;
     r.Bottom := r.Top;
     clipCursor(@r);
     tag := tag + 1;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     clipCursor(nil);
end;

end.


GL
Mike
0
 
LVL 9

Author Comment

by:ginsonic
ID: 7097799
Isn't exactly what I want but ...
Thanks for suppoert.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question