Solved

Changing mouse pointer

Posted on 1999-01-13
8
156 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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