First of all, I'm not at all sure that this is a DirectX question or a C# question. If it is misplaced please tell me so and I'll repost it elsewhere. But here goes:
I have two monitors in dualview, that is: if I move my cursor to the right of my screen it pops up on the other screen. When I'm in windowed mode I would like this behaviour but in fullscreen I would like to constrain the cursor to the primary screen / the fullscreen application.
I know many (most ) games does this in fullscreen and it's indeed very irritating if you miss and click on the right screen, then the fullscreen application will get minimized, lost and then you have to maximize it again.
Now I guess I could do a check constantly to see if the cursor is out of the application boundaries and warp it back but it's not an elegant solution at all and it may be slow aswell. This is a common problem and I guess it has a common solution. I haven't found any constrain functions that could help me in MSDN / DirectX Documentation.

[MDX] Constrain cursor to fullscreen window?
robatdural
Ben Jackson
With this said you can then use something like this
private void ValidateMouseCoordinates(Form window)
{
cursor = window.PointToClient(Cursor.Position);
if(cursor.X < 0) //if the x position is less than 0. set it to the window width
cursor.X = window.Width / 2; //keep it in the region of the of the first monitor.
if(cursor.Y < 0) //if the y position is less than 0. set it to the window height
cursor.Y = window.Height;
}
There might be a number of other ways to do this. This just seem the simplest right now.
I hope this helps.
Take care.
Lee Coward
Did you try Cursor.Clip
http://msdn2.microsoft.com/en-us/library/07yd9yty(en-US,VS.80).aspx
(my only concern is that it says it may not work unless the cursor is captured but the sample code doesn't show that)
GavinWu
But is there really no standard way to do this I guess I'll have to do bounds checking and warp if outside then O.o
Guy C.
My first guess is to determine where the mouse position is on the first screen. If it's greater than the screen's width/height, don't show the mouse cursor. If the mouse position is less than the width/height, show it again at a default center position (such as width/2, height/2). I believe the method for that is Cursor.Hide() and Cursor.Show(). Hope that helps.