|
| |||||||||
| Tags: cursor, hide cursor, show cursor, visual c |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to hide and show cursor in Visual C + +
Hi all, I am a programmer and using Visial C++ for coding in my project. I want to set a class that function will be hide and show cursor. In order to hide or show the index of the mouse device; return value greater than or equal to 0 display cursor Otherwise, hide the mouse. Please suggest some program.Thanks in advance. |
|
#2
| ||||
| ||||
| How to hide and show cursor in Visual C + +
If you have installed the mouse initial value is 0. For example:In the dialog-based application to place two Button, names, respectively HideCursor and ShowCursor; then placed on a CStatic control, named Label1, used to display the cursor counter. The Source as follows: Code: / / Make the cursor counter minus one, if less than zero, hide the cursor
void CMyTestDlg:: OnHideCursor ()
{
int i;
i = ShowCursor (FALSE);
Cstring string;
string.Format (_T ( "% d"), i);
Label123.SetWindowText (& string);
}
/ / Make the cursor counter value plus one, if greater than zero, display the cursor
void CMyTestDlg:: OnShowCursor ()
{
int j;
j = ShowCursor (TRUE);
Cstring string;
string.Format (_T ( "% d"), j);
Label123.SetWindowText (& string);
} |
|
#3
| ||||
| ||||
| How to hide and show cursor in Visual C + +
You can use Parameter fSwap, for Boolean, TRUE, said the exchange of the mouse left button, FALSE, said recovery system used by default right-hand man; return value is also a Boolean type, exchange, return value is TRUE, to restore normal for FALSE. For Example: Placed in the application of two Button, names, respectively ReverseMouse and RestoreMouse. Source as follows: Code: / / Exchange right mouse buttons
void CMyTestDlg:: OnReverseMouse ()
{
BOOL T;
T = SwapMouseButton123 (True);
If (T)
MessageBox ( "Mouse left key exchange successfully!");
}
/ / Restore the mouse left key exchange
void CMyTestDlg:: OnRestoreMouse ()
{
BOOL T;
T = SwapMouseButton123 (FALSE);
If (! T)
MessageBox ( "right mouse button to restore to default!");
} |
|
#4
| |||
| |||
| How to hide and show cursor in Visual C + +
If you want to get the mouse double-click the time, check the function: UINT GetDoubleClickTime (VOID); The function without parameters; its return value is in milliseconds, in order to double-click the mouse double-click the valid time interval. For example: In the window, place a Button, name GetDoubleClickTime; then placed on a named Label1 the CStatic control, used to display double-click the time. Source as follows: Code: / / Get and display the mouse double-click the time
void CMyTestDlg:: OnGetDoubleClickTime ()
{
int DTime123;
Cstring string;
DTime123: = GetDoubleClickTime ();
string.Format (_T ( "% d"), Dtime);
Label1.SetWindowText (& string);
} |
|
#5
| ||||
| ||||
| How to hide and show cursor in Visual C + +
If you want to set the mouse double-click the time, check the function: BOOL SetDoubleClickTime (UINT uInterval); Parameter uInterval, said the mouse double-click time for the milliseconds, the system default is 500; Return value is a Boolean value. For example : In the window, place a Button, name SetDoubleClickTime. Source as follows: Code: / / Set the mouse double click time
void CmyTestDlg:: OnSetDoubleClickTime ()
{
Bool T;
T = SetDoubleClickTime (200);
If (T)
MessageBox ( "successfully set up the mouse double-click the time!");
} |
|
#6
| ||||
| ||||
| How to hide and show cursor in Visual C + +
If you want to the mouse locked in a certain range, check the function: BOOL ClipCursor (CONST RECT * lpRect); Parameters * lpRect, pointing to the activities of a rectangular region of the mouse pointer; return value is a Boolean type, indicating success or failure of lock. For example: In the window, place two Button, name LockMouse and UnLockMouse. Source as follows: Code: / / Mouse locked in a fixed area
void CmyTestDlg:: OnLockMouse ()
{
RECT Rect;
BOOL bLock;
Rect.left = 15; / / set the lock area size;
Rect.top = 15;
Rect.right = 300;
Rect.bottom = 300;
bLock: = ClipCursor (& Rect); / / restrict mouse movement area
if (block)
MessageBox ( "mouse fixed in the designated area!");
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to hide and show cursor in Visual C + +" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MSP2010: Show/Hide Assignments | klaasbob | Microsoft Project | 3 | 09-08-2011 11:10 PM |
| What is Hide Method in Visual basic? | ^MALARVIZHI^ | Software Development | 4 | 02-01-2011 06:05 AM |
| How to hide the mouse cursor while playing the movie in the VLC full screen? | Mithras | Windows Software | 5 | 23-11-2010 07:33 AM |
| Need help to show/hide div | Nutty | Software Development | 3 | 16-04-2009 12:54 AM |
| Hide cursor in Power Point presentation | jeffcoo | Windows Software | 3 | 24-02-2009 09:40 PM |