Author Topic: WM_CLOSE vs WM_DESTROY  (Read 13341 times)

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: WM_CLOSE vs WM_DESTROY
« Reply #15 on: February 16, 2013, 08:26:02 AM »
... Don't child windows close automatically when the parent window is closed.

Hi Don57,
                Yes i think it is correct and we dont need to close them

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: WM_CLOSE vs WM_DESTROY
« Reply #16 on: February 16, 2013, 08:33:55 AM »
              Well suppose we create our main window which has his own message loop.
Now when we click one button we call ProcX that creates another window of another class and then it enters into a second msg loop. This second loop is not the first. What happen ? Are you saying all the messages are posted into the first window ?

a single message loop handles all messages for all windows in that process
you can create any number of windows in a process, and the messages are all dispatched by 1 loop

however, if you create another process, with its' own window(s) and own loop, those are seperate

Dave,

From Platform SDK:

»Elements of a Window Class
The elements of a window class define the default behavior of windows belonging to the class.
The application that registers a window class assigns elements to the class by setting appropriate members in a WNDCLASSEX structure and passing the structure to the RegisterClassEx function

Element Purpose
Class Name Distinguishes the class from other registered classes.
Window Procedure Address Pointer to the function that processes all messages sent to windows in the class and defines the behavior of the window

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: WM_CLOSE vs WM_DESTROY
« Reply #17 on: February 16, 2013, 08:34:49 AM »
Message queues are assigned* to threads and not processes! So a message loop only handles notifications for windows that has been created from the same thread.

*queues are only created, if the corresponding functions are used for that thread  (e.g. SendMessage, GetMessage, ... --> "GUI-thread")
MREAL macros - when you need floating point arithmetic while assembling!

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: WM_CLOSE vs WM_DESTROY
« Reply #18 on: February 16, 2013, 08:37:47 AM »
Message queues are assigned* to threads and not processes! So a message loop only handles notifications for windows that has been created from the same thread.

*queues are only created, if the corresponding functions are used for that thread  (e.g. SendMessage, GetMessage, ... --> "GUI-thread")

                Yes thanks qWord 

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: WM_CLOSE vs WM_DESTROY
« Reply #19 on: February 16, 2013, 08:40:24 AM »
sorry about that one   :P

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: WM_CLOSE vs WM_DESTROY
« Reply #20 on: February 16, 2013, 08:46:28 AM »
sorry about that one   :P

Dave,
          tomorrow i will try to create OverlappedWndY in another thread
See you  :biggrin:

Don57

  • Guest
Re: WM_CLOSE vs WM_DESTROY
« Reply #21 on: February 16, 2013, 08:51:04 AM »
Thanks for the help everybody.  :greenclp:

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: WM_CLOSE vs WM_DESTROY
« Reply #22 on: February 16, 2013, 09:09:03 AM »
Don57:

This is about child windows:

From SDK:

«A window can own, or be owned by, another window.
An owned window always appears in front of its owner window, is hidden when its owner window is minimized, and is destroyed when its owner window is destroyed

MtheK

  • Member
  • **
  • Posts: 141
Re: WM_CLOSE vs WM_DESTROY
« Reply #23 on: November 05, 2013, 09:15:35 PM »
  wrong post...sorry...