Solved

How uses Animation Cursor  ?

Posted on 1998-04-09
10
645 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
[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
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
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!

 

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
 
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

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!

Question has a verified solution.

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

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files 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