I just came across an interesting bug in RelayoutDialog().
In my version, this is around line 1001:
for(int i = 0; i < lpTemplate->cdit; i++)
{
lpData = reinterpret_cast<LPBYTE>(((INT)lpData + 3) & ~3);
// force to DWORD boundary.
LPDLGITEMTEMPLATE lpDlgItem = reinterpret_cast
<LPDLGITEMTEMPLATE>(lpData);
HWND hwndCtl = ::GetDlgItem(hDlg, lpDlgItem->id);
if(hwndCtl == NULL)
{
bRet = FALSE;
continue; //<--------------BUG HERE
}
//....some stuff
lpData += sizeof(DLGITEMTEMPLATE);
LPWORD lpClass = reinterpret_cast<LPWORD>(lpData);
lpData = WalkDialogData(lpData); // class
//....some more stuff
}
As you can see, the line where I marked BUG HERE is the problem. It
continues to the top of the for loop without ever walking to the next
item in the dialog template, so after if fails to find an item, it will
continue to try to find the same item until the for loop ends.
There is another 'continue' with the same problem on line 1029.
Thanks...
-Jason-