Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the Mouse Cursor Answered
Message
De
10/07/1997 18:59:07
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039275
Message ID:
00039364
Vues:
34
Have you tried to use SetCursor API function instead of SetSytemCursor()?

SetCursor() returns a handle to the previous cursor, so it should work like this:

hACursor = LoadCursor...
hSavedCursor = SetCursor( hACursor)
*-- Your code here...

*-- Now, restore cursor
SetCursor( hSavedCursor)

I haven't tried it, but it should work.

Also, there is a GetCursor() API function that returns a handle to the current cursor (no params).

HTH,
Vlad

>I've been using the same approach to change the system I-beam cursor. I'm still having a problem trying to restore the cursor to its original. Normal01.cur will give you the arrow back, but what if the user had an animated or custom cursor ? (See Microsoft Plus!).
>It would be nice to have a handle or some reference to the original system cursor before changing it, which I'm sure it's possible, I just didn't find it yet.
>
>>Someone was asking how to change the mouse cursor to a hourglass and it was suggested that the SETALL command be used to change the cursor properties of everything on the form. The following bit of code I think is a better solution:
>>
>>** these are the WIN32API functions u need for changing the
>>** mouse cursor.
>>declare integer LoadCursorFromFile in win32api as NewCur string declare short SetSystemCursor in win32api integer, integer
>>
>> *NORMAL 32512 - usually u would put these in a .h file
>> *IBEAM 32513
>> *WAIT 32514
>> *CROSS 32515
>> *UP 32516
>> *SIZE 32640
>> *ICON 32641
>> *SIZENWSE 32642
>> *SIZENESW 32643
>> *SIZEWE 32644
>> *SIZENS 32645
>> *SIZEALL 32646
>> *ICOCUR 32647
>> *NO 32648 (Win NT only)
>>
>> * get a handle for a new cursor
>> nCurHndl=NewCur("c:\vfp\samples\graphics\cursors\down.cur")
>>
>> * this example changes the noraml (arrow) cursor to the new cursor
>> * u can use normal01.cur to return to the normal cursor
>> nChangOK=SetSystemCursor(nCurHndl,32512)
>>
>> *after u changed one of the "system" cursors to ur own
>> *u can use the MousePointer property to referance it
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform