About Cursors - Win32 apps (2024)

  • Article

Windows provides a set of standard cursors that can be used by applications. The following cursor identifiers are defined in WinUser.h:

About Cursors - Win32 apps (1) Normal select
About Cursors - Win32 apps (2) Text select
About Cursors - Win32 apps (3) Busy
About Cursors - Win32 apps (4) Precision select
About Cursors - Win32 apps (5) Alternate select
About Cursors - Win32 apps (6) Diagonal resize 1
About Cursors - Win32 apps (7) Diagonal resize 2
About Cursors - Win32 apps (8) Horizontal resize
About Cursors - Win32 apps (9) Vertical resize
About Cursors - Win32 apps (10) Move
About Cursors - Win32 apps (11) Unavailable
About Cursors - Win32 apps (12) Link select
About Cursors - Win32 apps (13) Working in background
About Cursors - Win32 apps (14) Help select
About Cursors - Win32 apps (15) Location select
About Cursors - Win32 apps (16) Person select

A number of additional cursors are also available that do not have identifiers defined in WinUser.h (or are considered obsolete):

MAKEINTRESOURCE(32631)About Cursors - Win32 apps (17) A pen cursor.
MAKEINTRESOURCE(32652)About Cursors - Win32 apps (18) A scrolling cursor with arrows pointing north and south.
MAKEINTRESOURCE(32653)About Cursors - Win32 apps (19) A scrolling cursor with arrows pointing west and east.
MAKEINTRESOURCE(32654)About Cursors - Win32 apps (20) A scrolling cursor with arrows pointing north, south, east, and west.
MAKEINTRESOURCE(32655)About Cursors - Win32 apps (21) A scrolling cursor with an arrow pointing north.
MAKEINTRESOURCE(32656)About Cursors - Win32 apps (22) A scrolling cursor with an arrow pointing south.
MAKEINTRESOURCE(32657)About Cursors - Win32 apps (23) A scrolling cursor with an arrow pointing west.
MAKEINTRESOURCE(32658)About Cursors - Win32 apps (24) A scrolling cursor with an arrow pointing east.
MAKEINTRESOURCE(32659)About Cursors - Win32 apps (25) A scrolling cursor with arrows pointing north and west.
MAKEINTRESOURCE(32660)About Cursors - Win32 apps (26) A scrolling cursor with arrows pointing north and east.
MAKEINTRESOURCE(32661)About Cursors - Win32 apps (27) A scrolling cursor with arrows pointing south and west.
MAKEINTRESOURCE(32662)About Cursors - Win32 apps (28) A scrolling cursor with arrows pointing south and east.
MAKEINTRESOURCE(32663)About Cursors - Win32 apps (29) An arrow cd cursor.

See Guidelines for information on using standard cursors.

Each standard cursor has a corresponding default image associated with it. The user or an application can replace the default image associated with any standard cursor at any time. An application replaces a default image by using the SetSystemCursor function.

An application can use the GetIconInfo function to retrieve the current image for a cursor and can draw the cursor by using the DrawIconEx function.

Custom cursors are designed for use in a specific application and can be any design the developer defines. The following illustration shows several custom cursors.

About Cursors - Win32 apps (30)

Cursors can be either monochrome or color, and either static or animated. The type of cursor used on a particular computer system depends on the system's display. Old displays such as VGA do not support color or animated cursors. New displays, whose display drivers use the device-independent bitmap (DIB) engine, do support them.

Cursors and icons are similar and can be used interchangeably in many situations. The only difference between them is that an image specified as a cursor must be in the format that the display can support. For example, a cursor must be monochrome for a VGA display.

This overview provides information on the following topics:

  • The Hot Spot
  • The Mouse and the Cursor
  • Cursor Creation
  • Cursor Location and Appearance
  • Cursor Confinement
  • Cursor Destruction
  • Cursor Duplication
  • The Window Class Cursor

The Hot Spot

In the cursor, a pixel called the hot spot marks the exact screen location that is affected by a mouse event, such as clicking a mouse button. Typically, the hot spot is the focal point of the cursor. The system tracks and recognizes this point as the position of the cursor. For example, typical hot spots are the pixel at the tip of an arrow-shaped cursor and the pixel in the middle of a crosshair-shaped cursor. The following images shows two cursors from a drawing program, in which hot spots are associated with the tip of the brush and the crosshair of the paint can.

About Cursors - Win32 apps (31)

When a mouse input event occurs, the mouse driver translates the event into an appropriate mouse message that includes the coordinates of the hot spot. The system sends the mouse message to the window that contains the hot spot or to the window that is capturing mouse input. For more information, see Mouse Input.

The Mouse and the Cursor

The system reflects the movement of the mouse by moving the cursor on the screen accordingly. As the cursor moves over different parts of windows or into different windows, the system (or an application) changes the appearance of the cursor. For example, when the cursor crosses over a hyperlink, the system changes the cursor from an arrow to a hand.

About Cursors - Win32 apps (32)

If the system does not have a mouse, the system displays and moves the cursor only when the user chooses certain system commands, such as those used to size or move a window. To provide the user with a method of displaying and moving the cursor when a mouse is not available, an application can use the cursor functions to simulate mouse movement. Given this simulation capability, the user can use the arrow keys to move the cursor.

Cursor Creation

Because standard cursors are predefined, it is not necessary to create them. To use a standard cursor, an application retrieves a cursor handle by using the LoadCursor or LoadImage function. A cursor handle is a unique value of the HCURSOR type that identifies a standard or custom cursor.

To create a custom cursor for an application, you typically use a graphics application and include the cursor as a resource in the application's resource-definition file. At run time, call LoadCursor to retrieve the cursor handle. Cursor resources contain data for several different display devices. The LoadCursor function automatically selects the most appropriate data for the current display device. To load a cursor directly from a .CUR or .ANI file, use the LoadCursorFromFile function.

You can also create a custom cursor at run time by using the CreateIconIndirect function, which creates a cursor based on the content of an ICONINFO structure. The GetIconInfo function fills this structure with hot spot coordinates and information concerning the associated mask and color.

Applications should implement custom cursors as resources and use LoadCursor, LoadCursorFromFile, or LoadImage rather than create the cursor at run time. Using cursor resources avoids device dependence, simplifies localization, and enables applications to share cursor designs.

The CreateIconFromResourceEx function enables an application to create icons and cursors based on resource data. CreateIconFromResourceEx creates a cursor based on binary resource data from other executable (.exe) files or DLLs. It must be preceded by calls to the LookupIconIdFromDirectoryEx function, as well as several resource functions. LookupIconIdFromDirectoryEx identifies the most appropriate cursor data for the current display device. For more information about resource functions, see Resources.

Cursor Location and Appearance

The system automatically displays a cursor for the mouse and updates its position on the screen. You can obtain current screen coordinates of the cursor and move the cursor to any location on the screen by using the GetCursorPos and SetCursorPos functions, respectively.

You can also retrieve the handle to the current cursor by using the GetCursor function, and you can set the cursor by using the SetCursor function. After you call SetCursor, the appearance of the cursor does not change until either the mouse moves, the cursor is explicitly set to a different cursor, or a system command is executed.

When the user moves the mouse, the system redraws the cursor at the new location. The system automatically redraws the cursor design associated with the window to which the cursor is pointing.

You can hide and redisplay the cursor, without changing the cursor design, by using the ShowCursor function. This function uses an internal counter to determine when to hide or display the cursor. An attempt to show the cursor increments the counter; an attempt to hide the cursor decrements the counter. The cursor is visible only if this counter is greater than or equal to zero.

The GetCursorInfo function gets the following information for the global cursor: whether the cursor is hidden or shown, the handle to the cursor, and the coordinates of the cursor.

Cursor Confinement

You can confine the cursor to a rectangular area on the screen by using the ClipCursor function. This is useful for when the user must respond to a certain event within the confined area of the rectangle. For example, you might use ClipCursor to confine the cursor to a modal dialog box, preventing the user from interacting with other windows until the dialog box is closed.

The GetClipCursor function retrieves the screen coordinates of the rectangular area to which the cursor is temporarily confined. When it is necessary to confine the cursor, you can also use this function to save the coordinates of the original area in which the cursor can move. Then, you can restore the cursor to the original area when the new confinement is no longer necessary.

Cursor Destruction

You can destroy the cursor handle and free the memory the cursor used by calling the DestroyCursor function. However, this function has no effect on a shared cursor. A shared cursor is valid as long as the module from which it was loaded remains in memory. The following functions obtain a shared cursor:

  • LoadCursor
  • LoadCursorFromFile
  • LoadImage (if you use the LR_SHARED flag)
  • CopyImage (if you use the LR_COPYRETURNORG flag and the hImage is a shared cursor)

When you no longer need a cursor you created by using the CreateIconIndirect function, you should destroy the cursor. The DestroyIcon function destroys the cursor handle and frees any memory the cursor used. Use this function only on cursors that were created with CreateIconIndirect.

Cursor Duplication

The CopyCursor function copies a cursor handle. This enables application or DLL code to retrieve the handle to a cursor owned by another module. Then, if the other module is freed, the module that copied the cursor can still use the cursor design.

For information on how to add, remove, or replace cursor resources in executable files, see Resources.

The Window Class Cursor

When you register a window class, using the RegisterClass function, you can assign it a default cursor, known as the class cursor. After the application registers the window class, each window of that class has the specified class cursor.

To override the class cursor, process the WM_SETCURSOR message. You can also replace a class cursor by using the SetClassLong function. This function changes the default window settings for all windows of a specified class. For more information, see Class Cursor.

About Cursors - Win32 apps (2024)


Is custom cursors a virus? ›

Yes. A custom cursor is safe.

What is cursor and why is it used? ›

A cursor keeps track of the position in the result set, and allows you to perform multiple operations row by row against a result set, with or without returning to the original table. In other words, cursors conceptually return a result set based on tables within the databases.

What are Windows cursors? ›

In human–computer interaction, a cursor is an indicator used to show the current position on a computer monitor or other display device that will respond to input.

What does a cursor pointer do? ›

The cursor is a pointer that indicates a link. Typically an image of a pointing hand. The program is busy in the background, but the user can still interact with the interface (

Why should you avoid cursor? ›

Cursors are used to fetch single rows from the result set returned by a query and allow the row-by-row iteration through the result set, whereas set based processing can be much faster. Cursors can also cause transactional problems because of the run time.

Can a hacker control my cursor? ›

A hacker may be able to control your device remotely, without your permission. If you see your cursor move or your mouse click, it likely means someone else is controlling it, especially if applications are being opened. This attack is dangerous, so immediately disconnect from the internet or LAN.

What does the cursor tell you? ›

A cursor is a graphical element on your computer screen that shows your position in a software interface. Typically, it's represented by a blinking vertical line in text editors or a pointer arrow on your desktop.

What is the benefit of using cursors? ›

Response time Cursors can provide the first few rows before the whole result set is assembled. If you do not use cursors, the entire result set must be delivered before any rows are displayed by your application.

Should I use a cursor? ›

Therefore, you should use cursors and loops sparingly, and only when set-based operations are not feasible or efficient.

Why does my computer have two cursors? ›

When you are connected to a computer in a remote session, there may be two mouse cursors because the "Show Remote Cursor" setting is enabled. For Windows/Mac: If you want to disable the remote mouse cursor, please disable the "Show Remote Cursor" option.

Where are cursors stored in Windows? ›

If you find a couple (or several, if you're feeling fun) cursors you wish to install, you simply need to copy and paste the image files into the corresponding Cursors folder. For Windows 7, 8, or 10 users, look for the Cursors folder in the default Windows installation folder (C: > Windows > Cursors).

How do you get cursors on your computer? ›

Once you're in Mouse settings, select Additional mouse options from the links on the right side of the page. In Mouse Properties, on the Pointer Options tab, at the bottom, select Show location of pointer when I press the CTRL key, and then select OK. To see it in action, press the CTRL key.

What are cursors used for? ›

What are cursors used for? Cursors are often used to highlight text or objects on the screen so that they can be selected. For example, in a word processor, the cursor can be used to select text, format it, and insert new text. Users control cursors with input devices such as mice, touchpads and trackballs.

What is the purpose of cursor tools? ›

The Cursor Tools provide easy access to a number of closely related sub-features. They are located at the top-middle part of the user interface. There are additional cursors available by clicking and holding on the cursors with a small arrow to their right. Cursor Tools can also be activated by keyboard shortcuts.

When should you use cursor pointer? ›

Pointer cursors are the most commonly used cursor after the arrow and should always be used to indicate interactive elements.

Is it safe to change your cursor? ›

- Make sure any program you use to change icons/cursor is also from a reputable developer and has good security/permissions implemented.

Is cursor car a virus? ›

We have scanned the file and URLs associated with this software program in more than 50 of the world's leading antivirus services; no possible threat has been detected.

Is cute cursor a virus? ›

Update (2021-11-24): I've now looked into Cute Cursors, a competing extension with close to identical functionality. My conclusion is that Cute Cursors is secure, the attack surface is as minimal as it should be. So I recommend any Custom Cursor users to switch.

Is custom cursor safe for kids? ›

Our product is safe

Softpedia guarantees that Custom Cursor is 100% Clean. This software product was tested thoroughly and was found absolutely clean; therefore, it can be installed with no concern by any computer user.


Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 5611

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.