Add ani dynamic cool cursor on your own interface

Source: Internet
Author: User

First, import the. ani file to the project.
Click the Insert-> Resource menu in VC, click the Import button in the pop-up Insert Resource dialog box, and select "all files * in the" file type "drop-down list in the pop-up open file dialog box *. * ", select. ani File
Click the Import button. A Custom Resource dialog box is displayed. In the Resource type edit box, enter the name of the Resource to be created, for example, anicursor. Then, click OK, in this way, a resource named IDR_ANICURSOR1 will appear in your resource editor! In this way, the. ani file is imported into your program as a resource!

The dialog box is used as an example to describe how to use this resource.

1. First define a handle in the header file of the dialog box.
HCURSOR hCursor;

2. Load the resource in OnInitDialog, the initialization function of the dialog box. The Code is as follows:
HCursor = LoadCursor (AfxGetInstanceHandle (), MAKEINTRESOURCE (IDR_ANICURSOR1 ));

3. Reload the WM_SETCURSOR message in the dialog box and add the following code to the Message response function:
SetCursor (hCursor );
Return TRUE;
// Note that the default return statement after the message response function is added is
// Return CDialog: OnSetCursor (pWnd, nHitTest, message );
// We only need to let this function return true.

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.