Preventing user interaction with operating system(windows 2000) or any window on the desktop while s

G

Guest

H

this is the code in my windows for
------------------------------------

Cursor oldCursor = Cursor.Current
tr

Cursor.Current = Cursors.WaitCursor;

...............SOME PROCESSING............

DateTime dt = DateTime.Now.AddSeconds(10);
while(dt > DateTime.Now)

//do nothing
}


finally
{
Cursor.Current = oldCursor;


above code works fine with respect to the my windows form application, wait cursor is displaying properly, but when i move mouse cursor(wait cursor) out of my application, waitcursor is changing to arrow cursor. my application crashes when i click outside
How to prevent waitcursor changing to normal cursor when the cursor is outside of my windows form
My application consists a single windows form

----need hel
--------seash
 
M

Morten Wennevik

Hi seash,

You can't prevent a user going to another program, Microsoft has made it
intentional. This is an old battle between programmers wanting full
control and the users wanting to do whatever they like. The only way I
know of is to run a program before Explorer starts in some kiosk mode or
whatnot. You need to take into account that your program may lose focus
and handle it so that your program doesn't crash. There might be some way
for your program to get mouse information when the mouse if outside your
program, but I don't know how, and I suspect it involves hooks.

Maybe you can handle the events MouseEnter and MouseLeave to keep track of
the cursor.

Happy coding!
Morten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top