crashes on some systems.. please help
i've run out of ideas.. i'm working with a Tab Control and on some systems the program crashes when accessing a global HWND[2] for the two dialogs i use here. on my system it's all ok.
anyone know whats wrong here?
Code:
HWND phDlg[2];
// ...
// in the dialog procedure i catch WM_INITDIALOG and initialize phDlg.
// hwndDlg is the handle of the dialog the tab is placed on:
phDlg[0] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TABDIALOG1), hwndDlg, (DLGPROC)TabDlg1Proc);
phDlg[1] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TABDIALOG2), hwndDlg, (DLGPROC)TabDlg2Proc);
// then i catch TCN_SELCHANGING and TCN_SELCHANGE and show the appropriate dialog:
int nCurSel = TabCtrl_GetCurSel(hwndDlg);
if ((nCurSel >= 0) && (nCurSel <= 1))
ShowWindow(phDlg[nCurSel], SW_SHOW);
it works fine when i pass hwndDlg (from the parent window) to ShowWindow() which doesnt make sense of course but helped to localize the error. however, phDlg[0] or phDlg[1] as argument causes the app to crash - on some systems.