Skip to main content
GameDev.net gamedev.net
🔒 Locked

[Delphi] Mouse and form control

Started by Le Minie Jan 15, 2007 at 8:21 AM 0 replies 700+ views
Original Post
Le Minie
Le Minie
Hello, Form my program I need two things. For first I want to control mouse. Its mean that my application will be control mouse for whole system (Win). Somewhere I read about it, Its call exclusiveness accession to mouse. Application accept all messagess from mouse and If required send it next. I need for example hide mouse cursor, but when I use ShowCursor(false), cursor will be hidden only in region of form. And the second problem: I need to make form which will not activate after mouse button click, but operations will be done. For example program keyboard in Windows. After click on keyboard program stay inactive but simulation of pressing key is done but in other window (text editor). Thanks for advice
jakem3s90
jakem3s90
Are you going to be using this for a game? Hopefully I understand your question. [smile]

The way I've done it in the past is to use a combination of ShowCursor(false); as well as manipulating Mouse.CursorPos to force the mouse cursor to the center of the screen after each time control is input, and take the difference in the mouse cursor's position to update the scene.

A great example that uses a combination of ShowCursor and SetCursorPos (which is basically what Mouse.CursorPos does) can be found here:

Sulaco

It's a basic engine demo, but contains code for controls that I think you're looking for.

Hopefully this helps!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.