Results 1 to 4 of 4
  1. #1

    Problem with unexpected window for Main window


    We have a software that is built in Visual C++ 6 using MFC. It is an SDI
    application in which we have two child windows separated by a separator and
    embedded in main window.
    The left child window is a tree view and the right one varies depending on
    the options selected by the user.

    I was just trying to test the power of TestComplete, but have a problem of
    OnUnexpectedWindow event, which, I think, is wrongly being generated in my

    I am just trying to simulate clicks on each item of tree view using test
    complete. On each click to a node on tree view, there is a delay, as some
    function is being called on each click to a node.

    What my problem is that after two or three click, TestComplete gives an error
    saying that the MainWindow of MyApp is an unexpected window and it stops
    the script after few seconds (with error log of UnexpectedWindow).
    But how come a main window be an UnexpectedWindow of a Child window, as we
    know that Main window will always be visible and be a top level window all
    the time.

    Please suggest me some way to deal with this situation. Is there any workaround
    to it, or is there any method through which we can avoid this.

    This problem is really hindering my testing process.


  2. #2

    Re: Problem with unexpected window for Main window

    When you see problems with similar identifications of windows,

    1) Try to see if they are logged on as different processes in the object browser? If so maybe you can manipulate using the process.

    2) Try to see if you can index them, usually TestComplete does not use indexes, but sometimes adding them after the script is recorded might help getting out of such situations.

    3) The third option, this is the one I use most, is trying to shift focus between the main window and the child window. What might be happening is that the focus shifts on the main window whereas TestComplete is trying to execute something in the child window. To overcome this situation every once in a while (depending on what your test script does) shift focus to the window where you think the action should take place.

    For e.g. when you click on something in ChildWindow1 the focus might be shifting to MainWindow and then the script tries to execute something in ChildWindow1. Insert statements to explicitly shift focus to childwindow1. You might need to add a delay in order to avoid TestComplete and Windows changing focus.

    Hope this helps.

    - Pratik

  3. #3

    Re: Problem with unexpected window for Main window

    hi Patrik,
    thanks for your reply.
    i have already tried your 3rd option, i.e. i have used setfocus for child window before simulating click on child window , but it has not solved the problem and i am still getting same unexpected window event.
    Also, i have taken everything into consideration which you suggested in your previous mail, but in vain.

    - Puneet

  4. #4

    Re: Problem with unexpected window for Main window

    Hi Puneet,

    Would you please send your tested application to our support team? They will investigate the problem you are having.
    Bobby Edgar
    Save on AutomatedQA Products



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 03:38 PM.

Copyright BetaSoft Inc.