开发者

Multiple mouse/mice/cursor?

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 hypothetically, I can already detect which mouse is which. How can I make my own cursor t开发者_如何学Co go along with it. (using Delphi) Possibly along the lines of Multipoint

as an alternative, is there any software which can render more that one cursor. Like CPNMouse?

EDIT: I found that I can use the mouse_event Function in windows, but I still don't have the visual representation of the cursor.


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜