OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing TCursor

You can construct a TCursor in a number of ways: from an existing TCursor object, from a resource in the current application, from a resource in another application, or explicitly from size and data information.

You can create cursor objects from an existing cursor encapsulated in a TCursor object:

TCursor(HINSTANCE instance, const TCursor& cursor);

instance in this case should be the instance of the current application. TCursor does not encapsulate the application instance because TCursor objects know nothing about application objects. It is usually easiest to access the current application instance in a window or other interface object.

TCursor(HINSTANCE instance, TResId resId);
TCursor(HINSTANCE instance, const TPoint& hotSpot, TSize& size, void far* andBits, void far* xorBits);

You can also create a new TCursor object from an existing HCURSOR handle:

TCursor(HCURSOR handle, TAutoDelete autoDelete = NoAutoDelete);

This constructor is used to obtain an ObjectWindows object as an alias to a regular Windows handle received in a message.

There are two other constructors that are available only for 32-bit applications:

TCursor(const void* resBits, uint32 resSize);
TCursor(const ICONINFO* iconInfo);

The first constructor takes two parameters: resBits is a pointer to a buffer containing the cursor data bits (usually obtained from a call to LookupIconIdFromDirectory or LoadResource functions) and resSize indicates the number of bits in the resBits buffer.

The second constructor takes a single parameter, an ICONINFO structure. The constructor creates an icon from the information in the ICONINFO structure. The fIcon member of the ICONINFO structure must be false, indicating that the ICONINFO structure contains a cursor.

The destructor ~TCursor deletes the cursor. If the deletion fails, the destructor throws an exception.

See Also