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?