0

In our project, we use GDI to draw waveform and any other graphics, however, we meet a special problem, the situations are:

  1. The waveform stop drawing, just like not response.
  2. The buttons in toolbar also stop updating its background while mouse hots it or clicks it, however, it is very mystical, the button could respond event and open the relevant dialog.
  3. The dialog opened from toolbar could draw normally, any figures could work well.
  4. While resize the window, double click the title of application, anything works normally again.

So, I hope to know whether there is any bug or driven problem in Win7 64bits Pro version which have been reported.

The similar problems in stack-overflow see this link: What could cause redraw issues on 64-bit vista but not in 32-bit in .NET WInForms?

The code of drawing waveform and graphics, and

void CZMultiPatientView::UpdateDisplay(int ThisSecondCount, int ThisMillisecondCount) 
{
    CClientDC dc(this);
    CDC *pDC = &dc;

    //
    //   Draw waveforms
    //
    DrawPatientViewWaveforms(pDC);

    //
    //   Update parameters
    //
    if ((GetElapsedMilliseconds(mLastAlarmMillisecondCount, ThisMillisecondCount) >= 500) || (mForceRedraw)) 
    {             
        //
        //   !!!  SHOULD NOT DO THIS IN HERE !!!
        //
        if (mSetupParameterDialogDisplayed)
        {
            //mParameterDataDialog.UpdateCurrentParameterValues() ;
            m_pParamDlg->SendMessage(WM_UPDATE_VALUE); // Kevin
        }
    }

    if ((GetElapsedSeconds(mLastAlarmsecondCount, ThisSecondCount) >= 1) || (mForceRedraw))
    { 
        //Update messages (once a second)
        UpdateMessages(pDC);
        mLastAlarmsecondCount=ThisSecondCount;
    }

    if (GetElapsedMilliseconds(mLastDrawParametersCount, ThisMillisecondCount) >= 200 || (mForceRedraw))
    {
        PostMessage(APP_UPDATE_VIEWS, (WPARAM)ThisMillisecondCount, (LPARAM)mForceRedraw);
        mLastDrawParametersCount = ThisMillisecondCount;
    }

    //
    //   Update alarms
    //
    if (GetElapsedMilliseconds(mLastAlarmMillisecondCount, ThisMillisecondCount) >= 500) 
    {
        mLastAlarmMillisecondCount = ThisMillisecondCount ;
        DoSoundAlarmTone();
    }
    mForceRedraw = 0 ;
}
Community
  • 1
  • 1
Kevin Chen
  • 51
  • 1
  • 7
  • Please show us your drawing code, it is much more likely there is a bug in your code instead of a bug in windows. We can help you find it. – Scott Chamberlain Jan 13 '14 at 02:06
  • Hi Scott, I have added the code, please help to investigate, if you need more code, tell me. Thanks very much. – Kevin Chen Jan 13 '14 at 02:27
  • How (on what event) that UpdateDisplay() is called? As soon as you use CClientDC then I assume it is not inside WM_PAINT handler, right? – c-smile Jan 13 '14 at 02:31
  • Yes, we call it in another message handler, not WM_PAINT handler, and a timer posts message to message queue every 40 ms, and in that message handler, we call UpdateDisplay(). – Kevin Chen Jan 13 '14 at 02:33
  • What does "while mouse hots it" mean? – Gabe Jan 13 '14 at 02:34
  • 1
    Check if that timer is delivered to the window. – c-smile Jan 13 '14 at 02:35
  • "while mouse hots it" means the mouse moves over it, and the button get focus. – Kevin Chen Jan 13 '14 at 02:47
  • We have make sure that timer has been delivered to the windows, because in timer handler, there are any other function calls, they work normally. – Kevin Chen Jan 13 '14 at 02:48
  • Do you handle WM_PAINT at all on that window? – c-smile Jan 13 '14 at 03:05
  • Yes, we handle WM_PAINT message. – Kevin Chen Jan 13 '14 at 03:11
  • This behaviour sounds typical of a GDI resource leak. Are you sure you are releasing resources from the DC correctly, and destroying them accordingly? (edit) Oh forget that, I think I missed the bit about "making it all work again". – paddy Jan 13 '14 at 03:39
  • @paddy We have used tools to detect the GDI leak, however, we don't found any GDI leak. – Kevin Chen Jan 13 '14 at 05:22
  • I have added the code, please help to investigate, if you need more code, tell me. Thanks very much. @ScottChamberlain – Kevin Chen Jan 13 '14 at 07:04

0 Answers0