After displaying a popup error window the application responds very slow

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • After displaying a popup error window the application responds very slow

    In my application I create 27 dialog boxes at startup with GUI_CreateDialogBox().
    I do NOT use an API function to set the dialog boxes to modal state.

    Nevertheless I guess, that only the current foreground dialog box is handled in the message handler.
    Reason: Timers in dialog boxes are stopped when they are pushed to background.
    Therefore I see the dialog boxes as modal.

    The currently required dialog box is brought to the foreground with WM_BringToTop() and WM_InvalidateWindow().

    I use auto-memory-devices and the application is flicker free and reacts very fast.
    No one can see the change of dialog boxes.

    AND NOW THE PROBLEM COMES !

    To have a popup error window I also created one at startup with WM_CreateWindow(), in the background.
    It has 2 possible sizes. Both are smaller than the dialog boxes.
    I inserted a hide button in it with BUTTON_CreateEx().

    The reason for an error window instead of an error dialog box is, that button pressing is allowed
    BOTH in the popup error window AND in the button field of the dialog box behind.

    As long as the error window is in the background the application runs very fast.
    But when I bring it to the foreground the application is running very slow.

    The duration for bringing the error window to the top would be acceptable.
    But to bring it back into the background lasts seconds.
    Then everything runs with old speed.

    To show the error window I use these code lines:

    Source Code

    1. WM_MoveTo(m_hWnd, m_nXpos, m_nYpos); // Moves the window to different positions
    2. WM_SetSize(m_hWnd, m_nWidth, m_nHeight); // Sets 1 of the 2 possible window sizes
    3. WM_BringToTop(m_hWnd);
    4. WM_SetStayOnTop(m_hWnd, 1);
    5. WM_ShowWindow(m_hWnd);
    6. WM_MoveChildTo(m_hBtnHide, ERRBTN_XPOS, m_nYposBtn); // Moves the button to the correct position

    And to hide the error window I use these code lines:

    Source Code

    1. WM_SetStayOnTop(m_hWnd, 0);
    2. WM_BringToBottom(m_hWnd);

    What is the reason for this strange behavior?
    Can anyone help me to speed up the application?
    Our customer requires a much faster execution.

    Thanks in advance
    JuergenL
  • Hello Adrian,

    I have some new information.

    The error window is now created with new flags:

    Source Code

    1. m_hWnd = WM_CreateWindow(
    2. ERRWND_XPOS, ERRWND_YPOS_BIG, XSIZE_PHYS, ERRWND_HEIGHT_BIG,
    3. WM_CF_HIDE | WM_CF_STAYONTOP,
    4. &CErrorWindow::CallbackErrorWindow, 0);

    I now show the error window with these functions:

    Source Code

    1. WM_SetSize(m_hWnd, m_nWidth, m_nHeight); // Sets 1 of the 2 possible window sizes
    2. WM_MoveTo(m_hWnd, m_nXpos, m_nYpos); // Moves the window to different positions
    3. WM_MoveChildTo(m_hBtnHide, ERRBTN_XPOS, m_nYposBtn); // Moves the button to the correct position
    4. WM_ShowWindow(m_hWnd); // Shows the hidden window

    And VERY NEW: To hide the error window I use this function:

    Source Code

    1. GUI_MEMDEV_ShiftOutWindow(m_hWnd, 0, GUI_MEMDEV_EDGE_TOP);

    It seems that the hiding of the error window is a little bit faster!
    But that's not enough.

    I think that the problem is in the generating of the auto-memory-device, when 2 separate windows with 2 separate message loops are involved.
    Can that be right ?

    Or may it be, that the WM_PAINT messages of one window generates new messages in the other window and vice versa (escalation) ?
    That could explain the slow reaction.

    Do you have an idea ?

    Best regards,
    JuergenL