I recently converted a visual studio 6.0 project to visual studio 2010 and I'm encountering an issue whenever calling GetDlgItem on certain items. The following code is failing.
CWnd *pWnd = (CWnd*) GetDlgItem(IDC_BATCH);
pWnd->GetWindowText(szBatchNum);
I see this code in my resource file for the form that's calling the above code.
IDD_CC_PROCESS DIALOGEX 0, 0, 657, 410
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "",IDC_BATCH,"{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}",0x0,85,18,89,16
END
After the call to GetDlgItem() pWnd is NULL. This was not an issue in the 6.0 version of the project. IDC_BATCH seems to be a valid resource on this form. IDC_BATCH points to a "Microsoft Forms 2.0 Label". This seems to be one of the many issues I've encountered while converting the project from 6.0 to 2010.