Deleting all windows

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

  • Deleting all windows

    Hi,
    Suppose i have a diaglog and a window on the top of it. I can delete dialog using its handle but for window there's no handle. And for some reason i can not create as a child window and also can not use its handle. Its created using WM_CreateWindow API. How to delete this window ?


    is there any API which can delete whatever there is on screen and free the alloted memory ?
  • Hi,

    The easiest way would be to create a window as a child of the dialog. When deleting the dialog all of its child windows will be deleted, too.

    When you create the window with WM_CreateWindow() simply remember the return value of WM_CreateWindow(). The return value is the handle of the created window.

    Attached is a sample which shows how to create and delete windows in different ways.

    Regards,
    Sven
    Files
    • Sample.zip

      (978 Byte, downloaded 497 times, last: )
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • RE: Deleting all windows

    Hi Sven,


    yes that is the perfect way.. but in my case, i can not use this,

    hWin = WM_CreateWindow(10, 70, 50, 50, WM_CF_SHOW, _cbWin, 0);

    as the same line can get executed multiple times depending on the call.. So, the handle hWin will get overwritten.

    Is there any other way apart from the two which you have mentioned ?
    is there any API which can blindly delete whatever there is on screen and free the alloted memory ?
  • Hi,

    I have added a function to the sample code which iterates over all child windows of the desktop window and deletes them.

    Regards,
    Sven
    Files
    • Sample.zip

      (1.17 kB, downloaded 532 times, last: )
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.