Jump to content

Recommended Posts

Posted

@argumentum your suggestion "main window" or "main form" is a good idea, descriptive and correct, the word "main" makes all the difference. I wish you entered this thread earlier :D

3 hours ago, argumentum said:

We call it a GUI but is a form and inside that form we do what we do. Am not familiar enough to make a writeup about it nor can find a reference link with an explanation of how M$ windows calls each component 🤷‍♂️If any of you find such reference, please post it here.

This link :

Remarks
A top-level form is a window that has no parent form, or whose parent form is the desktop window.
Top-level windows are typically used as the main form in an application.

See how MS wrote "main form" in the remarks above ?


This link :

The great Raymond Chen on explanations :

A window can be created as a child window (WS_CHILD set) or a top-level window (WS_CHILD not set).
A child window has a parent, which you specify when you call CreateWindowEx, and which you can change by calling SetParent.
A top-level window, on the other hand, has no parent. Its parent is NULL.

 

3 hours ago, argumentum said:

calling the main window "the parent" is going to be brought up in the future, since there can be many child windows that each have it's own parent.

I second this.

Have a great evening both of you :bye:

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

@argumentum the intent is really to have ControlGetPos returning info about the parent window

THat what the proposal I will send to Jon

Cheers

Posted

Hello :) Concerning an example found in the help file, topic _WinAPI_GetAncestor

Local $hWnd, $hParent
$hWnd = GUICreate("test")
ConsoleWrite("Main GUI : $hWnd = " & $hWnd & @crlf) ; added this line for info
$hParent = _WinAPI_GetAncestor($hWnd, $GA_PARENT) ; $hParent is the desktop (as $hWnd is a top-level window)

MsgBox($MB_SYSTEMMODAL, "Parent", "Get Ancestor of " & $hWnd & ": " & $hParent)
MsgBox($MB_SYSTEMMODAL, "Root", "Get Ancestor of " & $hParent & ": " & _WinAPI_GetAncestor($hWnd, $GA_ROOT))
MsgBox($MB_SYSTEMMODAL, "Root Owner", "Get Ancestor of " & $hParent & ": " & _WinAPI_GetAncestor($hWnd, $GA_ROOTOWNER))

If not mistaken, the correct display should be :

...
MsgBox($MB_SYSTEMMODAL, "Parent", "Get Ancestor of " & $hWnd & ...) ; no change
MsgBox($MB_SYSTEMMODAL, "Root", "Get Ancestor of " & $hWnd & ...) ; change
MsgBox($MB_SYSTEMMODAL, "Root Owner", "Get Ancestor of " & $hWnd & ...) ; change

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

It was created by Gary in 2008

So I will update with

#include <MsgBoxConstants.au3>
#include <WinAPISysWin.au3>

Example()

Func Example()
    GUICreate("test")
    Local $idLabel = GUICtrlCreateLabel("label", 0, 0)
    Local $hLabel = GuiCtrlGetHandle($idLabel)
    MsgBox($MB_SYSTEMMODAL, "Parent", "Get Parent Ancestor of " & $hLabel & ": " & _WinAPI_GetAncestor($hLabel, $GA_PARENT))
    MsgBox($MB_SYSTEMMODAL, "Root", "Get Root Ancestor of " & $hLabel & ": " & _WinAPI_GetAncestor($hLabel, $GA_ROOT))
    MsgBox($MB_SYSTEMMODAL, "Root Owner", "Get Root Owner Ancestor of " & $hLabel & ": " & _WinAPI_GetAncestor($hLabel, $GA_ROOTOWNER))
EndFunc   ;==>Example

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...