Thread: crashes on some systems.. please help

  1. #1
    Registered User
    Join Date
    Feb 2006

    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?

    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.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    are you checking to make sure CreateDialog returned valid handles?
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program crashes and memory leaks
    By ulillillia in forum Tech Board
    Replies: 1
    Last Post: 05-15-2007, 10:54 PM
  2. DEV-C++ made program crashes when run from outside the ide
    By rainmanddw in forum C++ Programming
    Replies: 3
    Last Post: 01-20-2006, 10:27 PM
  3. APIs for windowing in other systems
    By sean in forum Tech Board
    Replies: 5
    Last Post: 08-23-2004, 11:45 AM
  4. Program crashes and I can't figure out why
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 09-19-2001, 05:33 PM