-
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?
-
-
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).