Solved

How uses Animation Cursor  ?

Posted on 1998-04-09
10
632 Views
Last Modified: 2012-06-27
hello ~
I am programming  animation cursor..

program is well running but when program is closed.
system is down. I don't know why system is down...?

this is my code ..

  case WM_CREATE :
       //load my animation cursor
       cur=LoadCursorFromFile("my.ani");                    
       SetSystemCursor(cur,OCR_NORMAL);
       break;

  case WM_PAINT :
       hdc=BeginPaint(hwnd,&ps);
       EndPaint(hwnd,&ps);
       break;

case WM_DESTROY :
       //set original cursor shape              
       cur=LoadCursorFromFile((LPWSTR)OCR_NORMAL);
       SetSystemCursor(cur,OCR_NORMAL);

       PostQuitMessage(0);
       break;

I will wait your answer....
thanks.
0
Comment
Question by:jhjeon
10 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1258063
Seems OK to me.
Run it under a debugger and see what error it reports.
0
 

Author Comment

by:jhjeon
ID: 1258064
I'm wondering about programming of animation cursor now.
I have spended on much time in it.
Thus, I tired of it.
If you have any source related in animation cursor,
please send Loading and Deleting part to me.

0
 
LVL 2

Expert Comment

by:lortega
ID: 1258065
The only line that i will change is

       cur=LoadCursorFromFile((LPWSTR)OCR_NORMAL);

for

       cur=LoadCursor(hInstance,IDC_ARROW);

this just let me load normal system cursor...

0
 

Author Comment

by:jhjeon
ID: 1258066
I changed LoadCursorFromFile to LoadCursor..(Iortga's comment)
but result is same ..(system down).
Is there anyone know this problem ?
HELP ~~~~... T.T
0
 

Author Comment

by:jhjeon
ID: 1258067
I want to solve this problem.
if you are technical programer,
please send me your answer....

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 10

Expert Comment

by:RONSLOW
ID: 1258068
The second LoadCursorFromFile (that is supposed to load the default system animated cursor) will fail and return a NULL handle if there is not animated system cursor (just an ordinary cursor).  Then the SetSystemCursor call will fail.

0
 

Author Comment

by:jhjeon
ID: 1258069
Function return to NULL or not
my problem is why system is down...

use or not use secound SetSystemCursor..
happen to same result that system is down ..

I think that secound SetSystemCursor is not related to
this problem.

before you send me answer. run this simple source and
examine your answer is correct or not.
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 100 total points
ID: 1258070
I have run it.

Your code causes the system to hang.

This code does not...

at start of program...

#define OCR_NORMAL          32512
HCURSOR hcur;
hcur = ::LoadCursorFromFile ("C\\WINDOWS\\CURSORS\\APPLE.ANI");                    
::SetSystemCursor(hcur,OCR_NORMAL);
      
at end of program...

hcur = ::LoadCursor(NULL,IDC_ARROW);
::SetSystemCursor(hcur,OCR_NORMAL);

It appears that the second LoadCursorFromFile in your code was at fault.

The above code was adapted from a MS KB article that shows how to modify the system cursor.

If you have any other problems, they are not due to the changing and restoring of the cursor
0
 

Author Comment

by:jhjeon
ID: 1258071
I am Sorry RONSLOW ..

fault was my program mistake
your source is right !!

thanks for your kindness and sincere answer..
have a good time !.
bye bye.. (^.^)

0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1258072
you're welcome .. good luck with your project

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

759 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

20 Experts available now in Live!

Get 1:1 Help Now