C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 05-24-2002, 05:37 AM   #1
Code Warrior
 
Join Date: Nov 2001
Posts: 669
Question How to disable a mouse in a console

Hi!

I noticed that if I have a mouse enabled in my console program and even if I do not move the mouse, it's still moving in some way (it seems that windows are refreshing the mouse every 500ms, i think).
I know this beacuse I'm checking the MOUSE_MOVED message.
I was checking the MSDN library but I found nothing.

Anyone knows how to disable a mouse in a console with the WINAPI functions?
__________________
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
GaPe is offline   Reply With Quote
Old 05-24-2002, 06:47 AM   #2
Registered User
 
alpha561's Avatar
 
Join Date: May 2002
Posts: 18
Rather than that, couldn't you just make it so the user can only use the keyboard (i.e.- don't provide any mouse support)?
__________________
alpha561

"You don't want to sell me death sticks"
alpha561 is offline   Reply With Quote
Old 05-24-2002, 07:07 AM   #3
&TH of undefined behavior
 
Fordy's Avatar
 
Join Date: Aug 2001
Posts: 5,220
To kill the cursor on a console I think you need to be in full screen mode......

You might want to look at a full Win32 app if you want more functionality
__________________
"If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut."
Albert Einstein (1879 - 1955)


Board Rules
Fordy is offline   Reply With Quote
Old 05-24-2002, 08:32 AM   #4
Code Warrior
 
Join Date: Nov 2001
Posts: 669
alpha561

NO WAY! The keyboard and the mouse are already completely coded. Now, I'm debbuging some things, like this for example.

Fordy
You misunderstood the question. I do not want to kill the cursor, I just want to disable the mouse.
__________________
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
GaPe is offline   Reply With Quote
Old 05-24-2002, 08:35 AM   #5
&TH of undefined behavior
 
Fordy's Avatar
 
Join Date: Aug 2001
Posts: 5,220
Then you want to stop the system sending your app mouse messages?....

You cant!! That is beyond the scope of your application....

What problem is it causing you?
__________________
"If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut."
Albert Einstein (1879 - 1955)


Board Rules
Fordy is offline   Reply With Quote
Old 05-24-2002, 08:53 AM   #6
Code Warrior
 
Join Date: Nov 2001
Posts: 669
There must be a way. I read something about the MOUSE_ENABLE_INPUT in the MSDN library but I don't know if this is it.

The problem is, uf that will be hard to explain. You try that and you'll get it.

Point your mouse on the menu, doesn't matter in which application you'll do that, click the command (FILE menu for example) and the menu will expand (will be opened). Now if you go with your mouse over some command, the command will than be selected. Now you leave your mouse alone and just use the keyboard (keys UP and DOWN) for selecting other commands. Now you see that, let's say, when you leave your mouse alone it was pointing on a command A. Then you press a key (UP or DOWN) and now the selected command is command B. In Windows application you'll notice that the command A will never get selected until you'll move the mouse or use the keyboard.
This is the problem in my console application. The mouse is pointing on a command A and when I use the keyboard, the command B will get selected but after 0.5 s, the command A will be again selected.

I hope this will help you to understand better my problem .
__________________
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
GaPe is offline   Reply With Quote
Old 05-24-2002, 11:59 AM   #7
Registered User
 
C_Coder's Avatar
 
Join Date: Oct 2001
Posts: 522
Not sure how accurate this is but you can set the console mode
Code:
SetConsoleMode( hStdin, ENABLE_LINE_INPUT );
where hStdin is a handle to the input buffer, this should stop the mouse messages from being placed in the input buffer. So just call this function when you want to ignore the mouse, to reactivate the mouse use
Code:
SetConsoleMode( hStdin, ENABLE_MOUSE_INPUT );
check out your docs though as there are other macros you can use ofr different needs.
Hope that helps
__________________
All spelling mistakes, syntatical errors and stupid comments are intentional.
C_Coder is offline   Reply With Quote
Old 05-26-2002, 05:45 AM   #8
Code Warrior
 
Join Date: Nov 2001
Posts: 669
I think this is the way but I have one HUGE problem. When the user is using the keyboard (UP, DOWN and RETURN keys) then the mouse will be disabled. And if the user is using mouse the keyboard will be disabled. I think this is impossible to code, beacuse if I disable the mouse, then how to enable it when the mouse moved or the button was clicked if the mouse is disabled?
__________________
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
GaPe is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Console Mouse and Key Input Yuri C++ Programming 3 02-18-2006 04:56 PM
Change colour of screen and disable mouse Meesa C Programming 2 05-18-2004 07:55 AM
Mouse Wheel In Console GaPe C Programming 0 09-07-2002 02:05 AM
Mouse support in console mode GaPe C Programming 1 04-17-2002 05:15 AM
Mouse in console vasanth C++ Programming 0 02-05-2002 11:32 PM


All times are GMT -6. The time now is 06:10 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22