Solved

Changing mouse pointer

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

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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