Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Animated (*.ani) cursor not showing

Animated (*.ani) cursor not showing

Scheduled Pinned Locked Moved C / C++ / MFC
testingbeta-testingquestionlearning
5 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    josip cagalj
    wrote on last edited by
    #1

    Hi, I've created a animated cursor which is 32x32 RGB/A. I tried to load it in my project (VS6) but it's not loading. Here are the steps I've done plus some code: 1. I've add my cursor (named 'OrangeWait.ani') in res folder, 2. defined new ID for it in 'resource.h' #define IDR_WAIT_CURSOR 124 3. added line in *.rc file IDR_WAIT_CURSOR ANICURSOR "res\\OrangeWait.ani" 4. and added some code for testing

    HCURSOR hCWait = ::LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR\_WAIT\_CURSOR));
    if(!hCWait)
    {
    	AfxMessageBox("Can't load Wait cursor!");
    	return;
    }
    HCURSOR hCStandard = ::LoadCursor(NULL,IDC\_ARROW);
    if(!hCStandard) AfxMessageBox("Can't load Standard cursor!");
    SetCursor(hCWait);
    Sleep(3000);
    SetCursor(hCStandard);
    

    When I start the app I get message "Can't load Wait cursor!". Any idea? Thanks...

    J 1 Reply Last reply
    0
    • J josip cagalj

      Hi, I've created a animated cursor which is 32x32 RGB/A. I tried to load it in my project (VS6) but it's not loading. Here are the steps I've done plus some code: 1. I've add my cursor (named 'OrangeWait.ani') in res folder, 2. defined new ID for it in 'resource.h' #define IDR_WAIT_CURSOR 124 3. added line in *.rc file IDR_WAIT_CURSOR ANICURSOR "res\\OrangeWait.ani" 4. and added some code for testing

      HCURSOR hCWait = ::LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR\_WAIT\_CURSOR));
      if(!hCWait)
      {
      	AfxMessageBox("Can't load Wait cursor!");
      	return;
      }
      HCURSOR hCStandard = ::LoadCursor(NULL,IDC\_ARROW);
      if(!hCStandard) AfxMessageBox("Can't load Standard cursor!");
      SetCursor(hCWait);
      Sleep(3000);
      SetCursor(hCStandard);
      

      When I start the app I get message "Can't load Wait cursor!". Any idea? Thanks...

      J Offline
      J Offline
      josip cagalj
      wrote on last edited by
      #2

      Just worked out. It seems I forget to rebuild. Funny.

      J 1 Reply Last reply
      0
      • J josip cagalj

        Just worked out. It seems I forget to rebuild. Funny.

        J Offline
        J Offline
        josip cagalj
        wrote on last edited by
        #3

        It's odd!!! I've changed the animated cursor for another one and replace it. Rebuild and back to "Can't load Wait cursor!" message. I've double checked everything but no, still wont work. Now it seams as rebuilding isn't the issue here. I even try to go back but to my original ani cursor still can't load it?! Then I tried to import animated cursors in the following way: - On Insert Resources dialog box clicked Import - Imported my animated cursors - Specified 'ANICURSORS' as type, and clicked 'OK' , but this too didn't give desired result. The same msg displayed. Did anyone successfully added animated cursor (32x32 RGB/A) and got it to work in VS6? If so how?

        J 1 Reply Last reply
        0
        • J josip cagalj

          It's odd!!! I've changed the animated cursor for another one and replace it. Rebuild and back to "Can't load Wait cursor!" message. I've double checked everything but no, still wont work. Now it seams as rebuilding isn't the issue here. I even try to go back but to my original ani cursor still can't load it?! Then I tried to import animated cursors in the following way: - On Insert Resources dialog box clicked Import - Imported my animated cursors - Specified 'ANICURSORS' as type, and clicked 'OK' , but this too didn't give desired result. The same msg displayed. Did anyone successfully added animated cursor (32x32 RGB/A) and got it to work in VS6? If so how?

          J Offline
          J Offline
          josip cagalj
          wrote on last edited by
          #4

          I found the new way to succeed, only this lines of code do the job

          HCURSOR hCursor = LoadCursorFromFile("res\\\\AnimatedCursor.ani");
          if(hCursor)
          	SetCursor(hCursor);
          

          Off course 'AnimatedCursor.ani' is the name of my source file. But another problem appeared when running under release mode, cursor is not loading. Why? It's a little sadly when talking to my self, isn't it?

          J 1 Reply Last reply
          0
          • J josip cagalj

            I found the new way to succeed, only this lines of code do the job

            HCURSOR hCursor = LoadCursorFromFile("res\\\\AnimatedCursor.ani");
            if(hCursor)
            	SetCursor(hCursor);
            

            Off course 'AnimatedCursor.ani' is the name of my source file. But another problem appeared when running under release mode, cursor is not loading. Why? It's a little sadly when talking to my self, isn't it?

            J Offline
            J Offline
            josip cagalj
            wrote on last edited by
            #5

            Well I can get really stupid some times can I? The file needs to be distributed along with application or it can not find and load it. Obviously if I want it to work I need to go back and include my ani cursor in my resource. But I cant get it to show (see previous posts). Does anybody know the solution to my problem?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups