dekaya 0 Newbie Poster

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;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.