What's the reason a handle for owner window required when creating an common dialog

72 views Asked by At

I'm working with common dialog recently and I've found that a hWndOwner is required in the structure that passed to functions like ChooseColor.

It seems of no difference when I used different hWndOwner. What does different hWndOwner choosing affects? Are there anything to take care when choosing the owner window?

1

There are 1 answers

0
ksyx On BEST ANSWER

Thanks for all who commented! Below are the key ideas I've got from the document.

  • There are a few things that relates to ownership, as taken from the document:

    • An owned window is always above its owner in the z-order.
    • The system automatically destroys an owned window when its owner is destroyed.
    • An owned window is hidden when its owner is minimized.
  • Setting owner to a child window (a window that is not a overlapped window or popup window) is equivalent to setting it to the top-level parent window.

  • The ownership could not be transferred after the window is created.

That's what I've learnt by reading the document. It would be much better if someone can give some extra information that is not included in the document.