When creating a window class for use with a DialogBox you need to add DLGWINDOWEXTRA to cbWndExtra. If you add extra data space to a DialogBox class be accessed by GetWindowLongPtr, should you add DLGWINDOWEXTRA to access this extra space?
(I'll confess that I think I know the answer, and that way the code doesn't break. But, I want to make sure my reasons tally with the collective wisdom.)
The major reason why Dialogs are being used with their own class (rather than the default) is to allow each class of Dialog to have its own Icon. Two separate items of extra data are also attached to each window.
...
wndclass.cbWndExtra = DLGWINDOWEXTRA+EXTRASPACE;
wndclass.lpfnWndProc = (WNDPROC) DefDlgProc;
wndclass.hIcon = LoadIcon(hInstance, "ICON_MAIN");
wndclass.lpszClassName = WND_CLASS_VLIST_POPUP;
wndclass.hIconSm = LoadImage(hInstance,
"ICON_MAIN",
IMAGE_ICON,
16,
16,
LR_DEFAULTCOLOR);
...
Late edit (removed the incorrect GWLP_USERDATA and replaced with 0 ):
Effectivly the question is:
GetWindowLongPtr(hWnd, 0 + DLGWINDOWEXTRA + SOMETHING_IN_EXTRASPACE);
or
GetWindowLongPtr(hWnd, 0 + SOMETHING_IN_EXTRASPACE);
?