Question

Using multiple mouse separately

Asked by: PIBM

I want to use at least 2 mouse at the same time (on windows). Those are two logitech optical wheel mouse. I need to have the variation on the X & Y axis of both mouse, separately.

I've tried enumerating the devices with Direct X 8.1 to no avail (well, that's my first try) since I only get one GUID even if I have two mices connected. Moving any of them move the cursor so yes they are both working.

I've included that in the mouse input sample coming with the Direct X 8.1 SDK

std::vector<GUID> aGUID;

BOOL CALLBACK DIEnumProc(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
{
   aGUID.push_back(lpddi->guidInstance);
   return DIENUM_CONTINUE;
}

in the OnCreateDevice fct after the Direct Input object creation.

     aGUID.clear();
     g_pDI->EnumDevices(DI8DEVTYPE_MOUSE, DIEnumProc, 0, DIEDFL_ATTACHEDONLY);

     {
          std::ostringstream os;
          std::hex(os);
          os << "GUID" << std::endl;

          for (int i = 0; i<aGUID.size(); ++i) {
               os << aGUID[i].Data1 << " " << aGUID[i].Data2 << " " << aGUID[i].Data3 << std::endl;
          }

          std::string lReponse = os.str();
          MessageBox(NULL, lReponse.c_str(), "TEST", MB_OK);
     }


I've also tried DIDEVTYPE_HID but I get no device. (and DIEDFL_ALLDEVICES, INCLUDEHIDDEN ..)

I tried direct x since I though we had access to everything... if that's not the solution feel free to use something else, if it's on windows..

I really need to get that working!
Thank you a lot,
  PIBM

2X pts bonus if I get a working answer before Valentine's Day! ;)

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-02-10 at 00:57:45ID20507162
Tags

mouse

,

multiple

Topic

Windows Programming

Participating Experts
4
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. A Dictionary Class using std::vector and std::string
    I am writing a Dictionary class that is responsible for storing definitions, adding new definitions, locating and displaying definitions and displaying the contents of the complete dictionary. I am required to have the Dictionary class definition in Dictionary.h and the imple...
  2. std::vector as a class member
    Using VC++ SP5 I would like to make a std::vector as a member of a class with an initial size of 1000 elements initialized to 0, but I can't seem to do it. This works: ////////////////////////////////////////////////////// #include <iostream> #include <v...
  3. vector conventions
    I would like to know the proper way to declare and initialize a vector and then output it ?? I don't know how to initialize the vector with values. This attempt to use an array did not work. How do these 5 values find a way into the vector declaration? I will assume if I...
  4. Vector multiplication
    Hi I want to do vector multiplication such that for (a=0;a<48;a++) { for (b=0;b<64;b++) } } so that I have two vectors b:=1,...64, 1,...64 and a:= 1,1...., 2,2...., ....48 then I wan to multiply a matrix T=[-1 0 30; 0 -1 20] with the vector above such ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: PIBMPosted on 2003-02-10 at 11:17:26ID: 7919810

I forgot to say it must work in win 2k & XP
Thank you again ..

 

by: steve_groPosted on 2003-02-11 at 00:35:09ID: 7923730

OK, Just for the heck of it, can you look up the pinout of the mouse and just connect the wires of two mice into one PS2 wire?  Perhaps (using ball mice) remove or disconnect the X wheel from one and the Y wheel, from the other (or disable something inside the optical mouse, like, snip a wire)?  Maybe I'm not making sense, but I'm trying to say: would you consider a physical rather than programmatical approach?  Or does this have to be a global, anyone with two mice can do it, solution, like for a game that you're developing?

I'm certain that you have a good reason for doing this, and I am most curious what that might be.

Regards,

-Steve G

 

by: PIBMPosted on 2003-02-11 at 09:35:55ID: 7927156

I'm sorry to say so but you've not understood what I want. I don't want to disable an axis of each mouse : I want to have the data from both mice at the same time separately.

That mean I want to know what the mouse 1 is doing and what the mouse 2 is doing. That way, I can have two people playing the same game each with a mouse, or I can put two mice together and know the rotational movement (and this is the part that interest me most)

I've made something with Direct Input that enumerate all the device -- I get the GUID of each mouse and then I open a connection to each mouse separately, thus getting the modification of each one .. That works, but only on Win 98 \ Me so far.. so I need something like this for win 2k & XP !

Thank you for your idea, that might get handy for something  else ;)

 

by: NickRepinPosted on 2003-02-23 at 23:27:56ID: 8006710

I'm afraid this only can be done with a device driver. A so-called  filter driver is required to intercept MOUSE_INPUT_DATA coming from mouse drivers.

You can also try to open a GUID_DEVINTERFACE_MOUSE device and then ReadFile( PMOUSE_INPUT_DATA ), but I think this would interfere with the system if worked at all.

Try also XP's WM_INPUT.

 

by: PIBMPosted on 2003-02-24 at 08:59:58ID: 8009619

Yeah I got it working on XP(Raw Input), as on win 95/98/me (DirectX)... but I need it on win 2k / XP with the same implementation.. I tried opening the device (with readfile) but the access was refused, perhaps since they where already open for 2k..

Do you know how to do thoses filter driver ? Is that device hooks ? I've been able to obtain the DDK of october 2001 if need be for a demo..

 

by: NickRepinPosted on 2003-02-24 at 10:00:59ID: 8010076

I know how to do and I did that. The filter driver hooks between the mouse class driver and Win32 subsystem, or betwen lower device drivers and the mouse class driver.

You may find an example on either www.osr.com or www.sysinternals.com.

 

by: PIBMPosted on 2003-02-24 at 15:58:37ID: 8012645

I've not found anything on your sites.. can you be more precise, or give me a sample ?

 

by: NickRepinPosted on 2003-02-24 at 21:59:45ID: 8014381

http://www.sysinternals.com/ntw2k/source/ctrl2cap.shtml

This is a keyboard filter, with minimal changes it will work as a mouse filter.

 

by: PIBMPosted on 2003-02-28 at 15:03:06ID: 8045249

Well, I've looked at it, compiled it, and still hasn't found at all how that could be usefull.

First I must adapt it to be able to get the data from the mouse and that doesn't seem so simple. Second how do we access the information that we are intercepting? Third, if we aren't administrator, does that work ??

I'll continue to look at it but it doesn't seem to be useable..

 

by: NickRepinPosted on 2003-02-28 at 20:27:17ID: 8046328

It is usable. The filter driver intercepts all IRPs (data packets) from mice to the system. I haven't looked at the code (I wrote my own drivers from scratch), but there must be IRP_MJ_DEVICE_CONTROL and IRP_MJ_READ handlers that pass the data through. The information can be accessed via DeviceIoControl() or ReadFile().

You have to be an admin to install a driver, but even a guest can receive data from a driver.

To convert a keyboard filter to a mouse one you need to replace GUIDs and KEYBOARD_INPUT_DATA with MOUSE_INPUT_DATA. That's basically it.

I wrote a mouse filter that was able to pass all raw mouse data to a user-mode program and block or simulate mouse input. It is easy to distinguish between different mouses on this level.

Sorry, but I cannot teach you device driver programming. It is simple to those who know, and pretty complicated for beginners.

 

by: PIBMPosted on 2003-02-28 at 20:54:53ID: 8046398

then can you give me your sample ? It's exactly what I need..

And how do we access this driver with another program (to get the data)?

 

by: NickRepinPosted on 2003-03-01 at 01:30:25ID: 8047106

>>then can you give me your sample

Sorry again, I do not write programs for free. I can't give you commercial driver code.

>>And how do we access this driver with another program (to get the data)?

This info is in DDK. You call DeviceIoControl() or ReadFile(), the driver receives IRP_MJ_DEVICE_CONTROL or IRP_MJ_READ.

 

by: PIBMPosted on 2003-03-02 at 06:42:27ID: 8051769

ok .. I though the driver was using these to get the data.. And that's only for a school project.. Guess I'd better keep the XP thing I did until I get more free time..

 

by: EsstuPosted on 2003-05-29 at 16:27:22ID: 8609840

If it's just for a school project, just have two programs - one for XP, one for 95/98/ME. Conceal them behind one front-end if you like, but separate programs will be a lot easier in some ways.

One technique I like to do here is to isolate the variant code from the static, and then have two programs sharing most of the code - avoids the version control nightmare.

 

by: PIBMPosted on 2003-05-29 at 21:15:56ID: 8611276

well it's completed since end of april.. I've used the winxp thing I found since I had no working solution for win2k..

I could have made a front-end, in the case I had been able to get the data...

Anyway, I believe this should be closed since I got no real answer..

 

by: PIBMPosted on 2004-03-24 at 06:25:37ID: 10667944

Well since none of them had the solution (nothing more than I initially proposed) I believe I should get a refund.. Anyone object ? (Not that I need the points but nothing)

NickRepin still gave good advice about device filter even if he didn't wanted to give out his code =) I would not mind if I had to give him the points, in case his answers could be helpfull to someone else..

 

by: DanRollinsPosted on 2004-03-24 at 15:27:37ID: 10672844

>> I would not mind if I had to give him the points...
Your call.  If you accept his comment as an answer, it will save us a step in the cleanup.
-- Dan

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...