Solved

Changing mouse pointer

Posted on 1999-01-13
8
151 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now