Both WTL and ATL use the system's dialog class. This window class includes a default cursor. See for yourself --
WNDCLASS wc{};
GetClassInfo(NULL, WC_DIALOG, &wc);
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
With respect to WTL/ATL, I noticed that when you call DoModal on a CDialogImpl, atlwin.h calls:
return ::DialogBoxParam(_AtlBaseModule.GetResourceInstance(),
MAKEINTRESOURCE(static_cast<T*>(this)->IDD),
hWndParent,
T::StartDialogProc,
dwInitParam);
, retrieving the dialog box information from the DIALOGEX description in the .rc file. I can't see how to add a CLASS item to this structure to set the window class to a custom one, as I need the T::StartDialogProc. When I put in the T::StartDialogProc for ATL::CDialogImpl, DialogBoxParam threw an access violation exception. I have to assume this is some kind of thunking problem.
My motivation is I have a specific issue with the IDC_WAIT cursor being shown for a few ms (it "flashes up" when I call DoModal) and my working theory right now is that my DIALOGEX doesn't have a default cursor. The reason I think this is because when I do the following in my WM_INITDIALOG handler:
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG) ::SetCursor(::LoadCursor(0, IDC_ARROW)));
, the problem is minimised, i.e. the cursor sometimes briefly flashes to wait. I think if it had a default cursor before it arrived at WM_INITDIALOG, i.e. from the window class, the problem will disappear completely.
So, is it possible to add a custom window class to a CDialogImpl, or to add a default cursor to the class CDialogImpl uses, and if so, how?
Both WTL and ATL use the system's dialog class. This window class includes a default cursor. See for yourself --
WNDCLASS wc{};
GetClassInfo(NULL, WC_DIALOG, &wc);