?
Solved

Changing mouse pointer

Posted on 1999-01-13
8
Medium Priority
?
159 Views
Last Modified: 2010-04-06
How can I change mouse pointer to a bitmap ?

Motaz
0
Comment
Question by:Motaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356305
(Shamelessly stolen from a previous answer given by ZifNab)

       Custom cursors can be added to the Cursors property for use by the application or any of its controls. To add a custom cursor to an  application:

         1 Create the cursor resource using a resource editor.
         2 Declare a cursor constant with a value that does not conflict with an existing cursor constant.
         3 Use the Windows API function LoadCursor to obtain a handle to the new cursor.
         4 Set the Cursors property, indexed by the newly declared cursor constant, to the handle obtained from LoadCursor.

         For example, assume that a custom cursor has been added to the resources of an application with the name NewCursor. The following code makes this cursor available to the application via the constant crMyCursor, and sets it as the global cursor to the application.

         const
           crMyCursor = 5;

         procedure TForm1.FormCreate(Sender: TObject);
         begin
           Screen.Cursors[crMyCursor] := LoadCursor(HInstance, 'NewCursor');
           Cursor := crMyCursor;
         end;

Cheers,

Raymond.
0
 
LVL 7

Author Comment

by:Motaz
ID: 1356306
I want to change it in run time with any bitmap, not with resource editor. Can I do so ?

by the way look to my Jpeg to bitmap quesion. Your answer didn't work

Thanks
Motaz
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1356307
Look at win API CreateCursor. Unfortunately it seems to work only for monochrome cursors...   :-(
I found no API to create a colored cursor at runtime. Of course you could create a *.cur file with a colored cursor, then use LoadCursorFromFile. But do you know the *.cur file format? I don't...

Regards, Madshi.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:Motaz
ID: 1356308
Okay, I need this because my friend work in project ( Destributed chess) and he want to drag the Pawn and Queens.. ext. so that he want to move the Pawn while dragging.

Motaz
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1356309
The TImageList component will do this for you. Look at the documentation of these TImageList functions:
                BeginDrag
            DragLock
            DragMove
            DragUnlock
            EndDrag
            GetHotSpot
            HideDragImage
            SetDragImage
            ShowDragImage

Regards, Madshi.
0
 
LVL 7

Author Comment

by:Motaz
ID: 1356310
Thanks Madshi, you can post any thing as answer.

Motaz
0
 
LVL 20

Accepted Solution

by:
Madshi earned 80 total points
ID: 1356311
Thank you, Motaz...  :-)
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356312
Motaz: Sorry my answer didn't help - some more details would have been useful :-)

PS: The JPEG thing is sorted out...

Cheers,

Raymond.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question