Visual C + + 6.0 API function manipulation techniques set

Source: Internet
Author: User

First, hide and display the cursor

function: int showcursor (BOOL bshow);

Parameter bshow, is a Boolean, hides the cursor when the bshow value is false, displays the cursor when True, the return value of the function is an integer, the exponent that is hidden or displayed for the mouse, the return value is greater than or equal to 0 o'clock displays the cursor, otherwise hides the mouse;

Instance:

Place two button in a dialog based application named Hidecursor and ShowCursor, and then place a CStatic control, named Label1, to display the cursor counter.

The source program is:

// 使光标计数器的值减一,如果小于零,隐藏光标
void CMyTestDlg::OnHideCursor()
{
int i;
i=ShowCursor(FALSE);
Cstring string;
string.Format(_T("%d" ),i);
Label1.SetWindowText(&string);
}
// 使光标计数器的值加一,如果大于等于零,显示光标
void CMyTestDlg::OnShowCursor()
{
int j;
j=ShowCursor(TRUE);
Cstring string;
string.Format(_T("%d" ),j);
Label1.SetWindowText(&string);
}

Run the program, click the ShowCursor button continuously, you will see the counter from 1 (the initial value of the cursor is 0) began to add 1, and then click the Hidecursor button continuously, you will see the counter continuously minus 1, when the counter is-1 o'clock to start hiding the cursor.

Second, the exchange of mouse around key and restore

Function:

BOOL Swapmousebutton (bool Fswap);

Parameter Fswap, Boolean, true to exchange the left and right side of the mouse key, false to restore the system default handedness; The return value is also a Boolean, and after the exchange, the return value is true, restoring the normal value to false.

Instance:

Place two button in the application, named Reversemouse and Restoremouse respectively.

The source program is:

//交换鼠标左右键
void CMyTestDlg::OnReverseMouse()
{
BOOL T;
T=SwapMouseButton(True);
If(T)
MessageBox("鼠标左右键交换成功!");
}

// 恢复鼠标左右键交换
void CMyTestDlg::OnRestoreMouse()
{
BOOL T;
T=SwapMouseButton(FALSE);
If(!T)
MessageBox("鼠标左右键恢复为默认状态!");
}

Run the program, left-click Reversemouse button, at this point to achieve the mouse left and right key function switch, and then right-click the Restoremouse button, at this point to achieve the mouse left key function recovery.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.