Multiple mouse/mice/cursor?

前端 未结 3 1125
孤城傲影
孤城傲影 2021-01-22 11:11

How can I show another cursor for multiple mice? I have two TMemos, two keyboards which can type into their respective TMemo, 2 mice and I need 2 cursors those.

If hypot

相关标签:
3条回答
  • 2021-01-22 11:55

    Windows doesn't support multiple mouse or keyboards. Since each process have only 1 input queue, Windows treats all similar input devices as the same single device. This can't be changed. End of story. Period.

    But even if you can't do this on system wide scale - you still can do this in one particular application. You need to write a special driver and install it for the second mouse only. This driver should not pass mouse movements to usual consumer (input queue), but rather redirect input directly to your application.

    You can use a already written drivers - for example, this one or the one, that you've already mentioned.

    0 讨论(0)
  • 2021-01-22 12:04

    It can be simulated its action virtually from the original cursor by doing something seamingly fast

    0 讨论(0)
  • 2021-01-22 12:06

    Cursors are just resources. Here is a good list of the standard cursors that can be used. TControl Defines a cursor property that can be set to the cursor that should be used when over a given control. You can also use Screen.Cursor to control the entire application cursor.

    To define a custom cursor you use the following code.

    {$R MyCustomCursors.RES}
    
    const
     crCustom1 = 1;
     crCustom2 = 2; 
    
    ...
    
      Screen.Cursors[crCustom1] := LoadCursor(hInstance, 'CUSTOM1');
      Screen.Cursors[crCustom2] := LoadCursor(hInstance, 'CUSTOM2');
    
    ...
    

    Delphi was not designed by default to deal with multiple mouse pointers, but the I suspect most environments are not. The SDK you mention is the only source of information I have seen on using multiple mice at the same time in a single application. It however is .NET only, so using it would require Delphi Prism.

    If you want to roll your own support for multiple mice the same trick of using WM_INPUT can can be used. Windows will treat both mice as the same. You will have to do custom painting of the mouse cursor by hand for the second mouse.

    0 讨论(0)
提交回复
热议问题