Problem:made Modal MessageBOx @ some event become modaless

Discussion in 'C++' started by saxenavaibhav17@gmail.com, Apr 26, 2007.

  1. Guest

    Hi Friends.

    I got many help from this forum.

    Thanks a lot guys.



    Well friends I have problem.

    In application,

    Dialog is there, I put button on that it popsup another dialog say
    cutting parameter dialog .

    On dialog there is spin button which decrease the corresponding edit
    box value when this value cross the validation i put value should be 0
    t o10000 .

    if user click on spin button to make it below 0.

    at that messageBox pops up. but this situation become Modaless.

    and all other dialog case



    following is the snippet of code.

    when I put break point at c i find in call stack it comes at
    position

    (a->b->c->d) sequence



    a)IMPLEMENT_MWLINVELSPIN_NOTIFY_WITH_CB(MWToolCutParamsDlg,IDC_EDIT_CUT_PARAM_Z_FEEDRATE,
    0, MAX_LINVEL_VAL, OnKillFocus)


    b) #define IMPLEMENT_MWLINVELSPIN_NOTIFY_WITH_CB( classname,
    editid,min,max,callback ) \
    IMPLEMENT_MWSPIN_NOTIFY_INTERNAL(m_LinVelUnit,classname,editid,min,max,-1.00)
    \
    callback##(); \
    }



    c) Outcome:utcome( int retVal, SeverityIndex sevIndex, UINT
    uTitleStrID,DWORD dwHelpID, CWnd* pParentWnd/* = NULL*/)
    {
    m_retVal = retVal;
    m_SevIndex = sevIndex;

    m_uTitleStrID = uTitleStrID;

    // test if it is a valid string id
    if( m_uTitleStrID )
    {
    //MWResourceLoader resLoad;
    CString strTitle;
    BOOL bValid = strTitle.LoadString(m_uTitleStrID);
    ASSERT(bValid);
    }

    // Set the Help ID
    m_dwHelpID = dwHelpID;
    m_bChangeMessageBoxButtonLabels = FALSE;
    m_pParentWnd = pParentWnd;
    }





    d)UINT Outcome:isplay(int nID, ...)
    {
    #ifdef AFR_PARASOLID
    return IDYES;
    #endif

    CString str;
    CString sout;
    TCHAR* ptr;
    va_list va;
    long retVal = -101;

    //MWResourceLoader resLoad;
    str.LoadString(nID); // load string from String table

    va_start(va,nID); // initialize va_list

    ptr = sout.GetBuffer(str.GetLength()+500);
    _vstprintf(ptr,str,va); // stuff ptr(sout) with data
    sout.ReleaseBuffer();

    CWinApp* pSWApp = AfxGetApp();
    CWnd* pSWWnd = NULL;
    if (NULL == m_pParentWnd)
    pSWWnd = (NULL != pSWApp) ? pSWApp->m_pMainWnd : NULL;
    else
    pSWWnd = m_pParentWnd;

    HWND hSWWnd = (NULL != pSWWnd) ? pSWWnd->GetSafeHwnd() : NULL;






    HWND hWndParent = hSWWnd;

    CString title;
    if( m_uTitleStrID )
    title.LoadString(m_uTitleStrID);

    UINT uMBType = 0;

    switch( m_SevIndex )
    {
    case MW_ERROR :
    if( !m_uTitleStrID )
    title.LoadString(IDS_COMM_COMM_MW_ERROR_TITLE);
    uMBType = MB_OK | MB_APPLMODAL | MB_ICONERROR | MB_SETFOREGROUND;
    break;
    case MW_WARNING :
    if( !m_uTitleStrID )
    title.LoadString(IDS_COMM_COMM_MW_WARNING_TITLE);
    uMBType = MB_YESNO | MB_APPLMODAL | MB_ICONWARNING |
    MB_SETFOREGROUND;
    break;
    case MW_OPTIONSWARNING:
    if( !m_uTitleStrID )
    title.LoadString(IDS_COMM_COMM_MW_WARNING_TITLE);
    uMBType = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONWARNING |
    MB_SETFOREGROUND;
    break;
    case MW_MESSAGE :
    if( !m_uTitleStrID )
    title.LoadString(IDS_COMM_COMM_MW_MESSAGE_TITLE);
    uMBType = MB_OK | MB_APPLMODAL | MB_ICONINFORMATION |
    MB_SETFOREGROUND;
    break;
    default:
    ASSERT(0);
    break;
    }



    Thanks in advance guys ;-)
     
    , Apr 26, 2007
    #1
    1. Advertising

  2. Jim Langston Guest

    <> wrote in message
    news:...
    > Hi Friends.
    >
    > I got many help from this forum.
    >
    > Thanks a lot guys.
    >
    >
    >
    > Well friends I have problem.
    >
    > In application,
    >
    > Dialog is there, I put button on that it popsup another dialog say
    > cutting parameter dialog .
    >
    > On dialog there is spin button which decrease the corresponding edit
    > box value when this value cross the validation i put value should be 0
    > t o10000 .
    >
    > if user click on spin button to make it below 0.
    >
    > at that messageBox pops up. but this situation become Modaless.
    >
    > and all other dialog case
    >
    >
    >
    > following is the snippet of code.
    >
    > when I put break point at c i find in call stack it comes at
    > position
    >
    > (a->b->c->d) sequence
    >
    >
    >
    > a)IMPLEMENT_MWLINVELSPIN_NOTIFY_WITH_CB(MWToolCutParamsDlg,IDC_EDIT_CUT_PARAM_Z_FEEDRATE,
    > 0, MAX_LINVEL_VAL, OnKillFocus)
    >
    >
    > b) #define IMPLEMENT_MWLINVELSPIN_NOTIFY_WITH_CB( classname,
    > editid,min,max,callback ) \
    > IMPLEMENT_MWSPIN_NOTIFY_INTERNAL(m_LinVelUnit,classname,editid,min,max,-1.00)
    > \
    > callback##(); \
    > }
    >
    >
    >
    > c) Outcome:utcome( int retVal, SeverityIndex sevIndex, UINT
    > uTitleStrID,DWORD dwHelpID, CWnd* pParentWnd/* = NULL*/)
    > {
    > m_retVal = retVal;
    > m_SevIndex = sevIndex;
    >
    > m_uTitleStrID = uTitleStrID;
    >
    > // test if it is a valid string id
    > if( m_uTitleStrID )
    > {
    > //MWResourceLoader resLoad;
    > CString strTitle;
    > BOOL bValid = strTitle.LoadString(m_uTitleStrID);
    > ASSERT(bValid);
    > }
    >
    > // Set the Help ID
    > m_dwHelpID = dwHelpID;
    > m_bChangeMessageBoxButtonLabels = FALSE;
    > m_pParentWnd = pParentWnd;
    > }
    >
    >
    >
    >
    >
    > d)UINT Outcome:isplay(int nID, ...)
    > {
    > #ifdef AFR_PARASOLID
    > return IDYES;
    > #endif
    >
    > CString str;
    > CString sout;
    > TCHAR* ptr;
    > va_list va;
    > long retVal = -101;
    >
    > //MWResourceLoader resLoad;
    > str.LoadString(nID); // load string from String table
    >
    > va_start(va,nID); // initialize va_list
    >
    > ptr = sout.GetBuffer(str.GetLength()+500);
    > _vstprintf(ptr,str,va); // stuff ptr(sout) with data
    > sout.ReleaseBuffer();
    >
    > CWinApp* pSWApp = AfxGetApp();
    > CWnd* pSWWnd = NULL;
    > if (NULL == m_pParentWnd)
    > pSWWnd = (NULL != pSWApp) ? pSWApp->m_pMainWnd : NULL;
    > else
    > pSWWnd = m_pParentWnd;
    >
    > HWND hSWWnd = (NULL != pSWWnd) ? pSWWnd->GetSafeHwnd() : NULL;
    >
    >
    >
    >
    >
    >
    > HWND hWndParent = hSWWnd;
    >
    > CString title;
    > if( m_uTitleStrID )
    > title.LoadString(m_uTitleStrID);
    >
    > UINT uMBType = 0;
    >
    > switch( m_SevIndex )
    > {
    > case MW_ERROR :
    > if( !m_uTitleStrID )
    > title.LoadString(IDS_COMM_COMM_MW_ERROR_TITLE);
    > uMBType = MB_OK | MB_APPLMODAL | MB_ICONERROR | MB_SETFOREGROUND;
    > break;
    > case MW_WARNING :
    > if( !m_uTitleStrID )
    > title.LoadString(IDS_COMM_COMM_MW_WARNING_TITLE);
    > uMBType = MB_YESNO | MB_APPLMODAL | MB_ICONWARNING |
    > MB_SETFOREGROUND;
    > break;
    > case MW_OPTIONSWARNING:
    > if( !m_uTitleStrID )
    > title.LoadString(IDS_COMM_COMM_MW_WARNING_TITLE);
    > uMBType = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONWARNING |
    > MB_SETFOREGROUND;
    > break;
    > case MW_MESSAGE :
    > if( !m_uTitleStrID )
    > title.LoadString(IDS_COMM_COMM_MW_MESSAGE_TITLE);
    > uMBType = MB_OK | MB_APPLMODAL | MB_ICONINFORMATION |
    > MB_SETFOREGROUND;
    > break;
    > default:
    > ASSERT(0);
    > break;
    > }


    This looks like Microsoft specific code, so is off topic here. Try one of
    the Microsoft newsgroups.
     
    Jim Langston, Apr 27, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leila
    Replies:
    0
    Views:
    437
    Leila
    Apr 26, 2005
  2. Matt
    Replies:
    1
    Views:
    3,194
    Whitecrest
    Jun 1, 2004
  3. Don
    Replies:
    0
    Views:
    382
  4. Matt
    Replies:
    0
    Views:
    233
  5. gopal srinivasan
    Replies:
    0
    Views:
    281
    gopal srinivasan
    Nov 5, 2004
Loading...

Share This Page