954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

win32 mouse cursor control

Hi
I was experimenting with a simple mouse cursor change that
was previously posted. Can anyone tell me why it fails to work under DEV-CPP

The code has all the calls commented out
except the last one to demonstrate the hourglass appearance.
remark out the last call and the hourglass never appears.

If you unremark them, it still has no effect on the cursor.

#include <cstdlib>
#include <iostream>

//compiles and runs but the cursor is NOT under my control
//It shows a pointer with a hour glass immediately for 5 or 6
 //seconds even before the first "pause" .  

//I believe the cursor is changing just because the windows.h
// function is involved later  (last line of code)
// If I comment the last line out, no more hour glass

// Is it possible to control the cursor in console apps?

#include <windows.h> //win32 functions

using namespace std;

int main(int argc, char *argv[])
{
    // if you make any calls to windows.h anywhere in your code
    // it seems to make the hourglass show up for a few seconds at 
   //the beginning of your program.  Why?
   
   
    system("PAUSE");
    
    //SetCursor(LoadCursor(NULL,IDC_WAIT));
    //ShowCursor(TRUE);

    // just wasting some time
    for (int i =0;  i <100; i++)
      {
        cout << "i=" << i << " ";
        Sleep(100);
      }

   //ShowCursor(FALSE);
   
   SetCursor(LoadCursor(NULL,IDC_ARROW));


   system("PAUSE");
 
   return EXIT_SUCCESS;
}
dekaya
Newbie Poster
4 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You