Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 04-20-2011, 02:49 PM
Frag_68 Frag_68 is offline
Senior Member
 
Join Date: May 2008
Posts: 146
Default Broadcast Mouse movements

As an IT person in a school, we're often running around and completing the same task on many machines. For instance, we want to adjust one little setting on all the computers. I've researched this a bit in the multiboxing communities, but there doesn't seem to be a free, simple executable that I could drop on my clients and control them all simultaneously. So... I want to write my own.

The question is... where do I start? I've done a lot of Delphi programming, but I've never tried to write one that communicates across a network. Let alone to 30 machines at once. My goal would be to have a "server" app and then a "client" app. If I could broadcast mouse movements and clicks, that'd be great. If I could also broadcast keystrokes... that'd be awesome.

Any thoughts?

Thanks!
Reply With Quote
  #2  
Old 04-22-2011, 09:28 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 6,700
Default

I doubt this is possible to send messages over a network...

What you could do is write a message recorder/player app... Just record on 1 pc, copy the app including the recording to the other pc's and execute...
Reply With Quote
  #3  
Old 04-22-2011, 04:19 PM
Frag_68 Frag_68 is offline
Senior Member
 
Join Date: May 2008
Posts: 146
Default

Actually, I got it working for mouse clicks. I use TIDudpserver and client and simply set the host to the broadcast IP (ex. 192.168.1.255 for a Class C subnet) then send out the message. It worked perfectly. Now to figure out how to add keystrokes. I'll post more complete code when finished.
Reply With Quote
  #4  
Old 05-15-2011, 03:51 AM
Frag_68 Frag_68 is offline
Senior Member
 
Join Date: May 2008
Posts: 146
Default

So here's the basic of what I did to facilitate sending the mouse over the network. To conserve bandwidth, I only sent clicks, but I had easily replicated mouse movements as well.


MASTER:

Code:
procedure TForm1.Timer1Timer(Sender: TObject);
var
  pt : TPoint;
  x,y : string;
begin
  if GetAsyncKeyState(VK_LBUTTON) >= 0 then
    wassent := false;
  if (wassent = false) and (GetAsyncKeyState(VK_LBUTTON) < 0) then
  begin
    wassent := true;
    getcursorpos(pt);
    x := inttostr(pt.X);
    y := inttostr(pt.y);
    idudpclient1.Send(x+','+y);
  end;
end;

MINION:

Code:
procedure TForm1.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
  AData: TBytes; ABinding: TIdSocketHandle);
var
  LMsg: string;
  cpos, x,y : integer;
begin
  if Length(AData) <> 0 then
  begin
    LMsg := BytesToString(AData);
    cpos := pos(',',lmsg);
    x := strtoint(copy(lMsg, 1, cpos-1));
    y := strtoint(copy(lmsg,cpos+1,maxint));
    setcursorpos(x,y);
    Mouse_Event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
    Mouse_Event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
  end;
end;
The completed project, which also facilitates keyboard transmission as well can be found here:
http://sites.google.com/site/fragsixtyeight/home/mb
Reply With Quote
Reply

Tags
broadcast, lab, mouse, multibox, network

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:25 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.