Solved

Changing mouse pointer

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

Motaz
0
Comment
Question by:Motaz
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 20 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 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