Thread: wait cursor

  1. #1
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916

    wait cursor

    I have a straight Win32 API app (no MFC), and I want to display the wait (hourglass) cursor while certain procedures run because they take a while. I tried something like this:
    Code:
    SetCursor( LoadCursor( NULL, IDC_WAIT));
    // my function
    // ...
    SetCursor( LoadCursor( NULL, IDC_ARROW));
    but even though the "my function" section takes several seconds to execute, I never saw the cursor change. My window definition looks like this:
    Code:
    	WNDCLASSEX wcex;
    
    	wcex.cbSize = sizeof(WNDCLASSEX); 
    
    	wcex.style			= CS_HREDRAW | CS_VREDRAW;
    	wcex.lpfnWndProc	= (WNDPROC)WndProc;
    	wcex.cbClsExtra		= 0;
    	wcex.cbWndExtra		= 0;
    	wcex.hInstance		= hInstance;
    	wcex.hIcon		= (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SWITCHCONF32),
                             IMAGE_ICON, 32, 32, 0);
    	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
    	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
    	wcex.lpszMenuName	= (LPCTSTR)IDC_SWITCHCONF;
    	wcex.lpszClassName	= szWindowClass;
    	wcex.hIconSm		= (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SWITCHCONF16),
                             IMAGE_ICON, 16, 16, 0);
    Am I doing something inherently wrong with these calls, or is this problem more complicated than that?
    Away.

  2. #2

  3. #3
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Thank you, that worked well when the mouse is over one of my application's windows. However, is there a way that I can force the mouse cursor to be IDC_WAIT even when it is over the desktop or another window? My program has a main window which is just a menu bar at the top of the screen and then has several dialogs that appear based on selections made in the menu. I'd liketo display a wait cursor as these are loaded (there is background processing that happens before they appear).
    Away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why wait cursor still turning on?
    By Opariti in forum Windows Programming
    Replies: 0
    Last Post: 05-22-2009, 02:28 AM
  2. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  3. Custom Animated Cursor
    By willc0de4food in forum Windows Programming
    Replies: 3
    Last Post: 05-13-2005, 10:05 PM
  4. cursor remains in openGL fullscreen
    By Ken Fitlike in forum Game Programming
    Replies: 5
    Last Post: 03-14-2002, 08:52 PM
  5. Mouse in 800x600 24Bit Mode?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 11-11-2001, 01:38 AM