Jump to content

Recommended Posts

Posted
13 hours ago, mLipok said:

Could somebody show example when Test 1 result is different from Test 2 ?

 

; Local $hWnd_2 = GUICreate("Window 2", Default, Default, -1, -1, -1, -1, $hWnd_0) ; owned window
Local $hWnd_2 = GUICreate("Window 2", Default, Default, -1, -1, $WS_CHILD, -1, $hWnd_0) ; child window

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

Posted (edited)

For the record, I found a possible issue with the extended style $WS_EX_MDICHILD
Though the window is created with this extended style, its value doesn't appear with AutoIt Window Info Tool or with _WinAPI_GetWindowLong etc...
To make it appear, I need to force it, after the window creation, with _WinAPI_SetWindowLong
Don't know if it's only on my computer or if it can be reproduced on other computers.

Here is an example, just look at the Console after you close the MsgBox :
* First  line indicates 0x00000100 (the forced Exstyle $WS_EX_WINDOWEDGE)
* Second line indicates 0x00000140 ($WS_EX_WINDOWEDGE + $WS_EX_MDICHILD which is 0x00000040)

If you think it is a bug, then I'll create a Trac Ticket with a simpler script than the following :

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

Opt("MustDeclareVars", 1)

Example()

Func Example()
    Local $hGUI, $hMdiChild

    $hGUI = GUICreate("")
    WinSetTitle($hGUI, "", "GUI  " & $hGUI)
    GuiCtrlCreateLabel("Label in GUI", 200, 0, 90, 20)
    GUICtrlSetBkColor(-1, 0xFFFF00)

    $hMdiChild = GUICreate("", 300, 200, 0, 0, -1, $WS_EX_MDICHILD, $hGUI)
    WinSetTitle($hMdiChild, "", "MdiChild  " & $hMdiChild)
    GuiCtrlCreateLabel("Label in MdiChild", 200, 0, 90, 20)
    GUICtrlSetBkColor(-1, 0x00FFFF)

    GUISetState(@SW_SHOW, $hGUI)
    GUISetState(@SW_SHOW, $hMdiChild)

    MsgBox($MB_TOPMOST, "Parent/Ancestors of MdiChild window "  & $hMdiChild , _
        "Reminder : $hGUI = " & $hGUI & @crlf & _
        "Reminder : $hMdiChild = " & $hMdiChild & @crlf & @crlf & _
        "_WinAPI_GetParent = " & _WinAPI_GetParent($hMdiChild) & " (owner, not parent +++)" & @crlf & @crlf & _
        "_WinAPI_GetAncestor (Parent)   = " & _WinAPI_GetAncestor($hMdiChild, $GA_PARENT) & " (desktop)" & @crlf & _
        "_WinAPI_GetAncestor (Root)     = " & _WinAPI_GetAncestor($hMdiChild, $GA_ROOT) & " (itself)" & @crlf & _
        "_WinAPI_GetAncestor (Owner)  = "   & _WinAPI_GetAncestor($hMdiChild, $GA_ROOTOWNER) & " (gui)")

    ConsoleWrite("1 - ExStyles of $hMdiChild : 0x" & Hex(_WinAPI_GetWindowLong($hMdiChild, $GWL_EXSTYLE), 8) & @crlf)

    _WinAPI_SetWindowLong($hMdiChild, $GWL_EXSTYLE, $WS_EX_MDICHILD)
    ConsoleWrite("2 - ExStyles of $hMdiChild : 0x" & Hex(_WinAPI_GetWindowLong($hMdiChild, $GWL_EXSTYLE), 8) & @crlf)

    Do
    Until GUIGetMsg() = -3

    GuiDelete($hMdiChild)
    GuiDelete($hGUI)
EndFunc   ;==>Example

 

Edited by pixelsearch
typo

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

Posted
5 hours ago, jpm said:

Many Thanks I have committed something similar based on wikipedia x11

Looks good @jpm, Thanks very much!

Best regards,

Donny

LibreOffice UDF  

Scite4AutoIt Spell-Checker Using LibreOffice

WPS Office adapter — Use MS Word UDFs with WPS Office!

LibreOffice API Inspector tools

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

Posted
6 hours ago, pixelsearch said:

Here is an example, just look at the Console after you close the MsgBox :
* First  line indicates 0x00000100 (the forced Exstyle $WS_EX_WINDOWEDGE)
* Second line indicates 0x00000140 ($WS_EX_WINDOWEDGE + $WS_EX_MDICHILD which is 0x00000040)

If you think it is a bug, then I'll create a Trac Ticket with a simpler script than the following :

First What I did is to change:

$hMdiChild = GUICreate("", 300, 200, 0, 0, -1, $WS_EX_MDICHILD, $hGUI)

to

$hMdiChild = GUICreate("", 300, 200, 0, 0, -1, BitOR($WS_EX_WINDOWEDGE, $WS_EX_MDICHILD), $hGUI)

 

but it still won't work and I have the same result as you have:

Quote

1 - ExStyles of $hMdiChild : 0x00000100
2 - ExStyles of $hMdiChild : 0x00000140

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

modified example:

;~ https://www.autoitscript.com/forum/topic/153782-help-filedocumentation-issues-discussion-only/page/43/#findComment-1551537
#include <MsgBoxConstants.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Example()

Func Example()
    Local $hGUI, $hMdiChild

    $hGUI = GUICreate("")
    WinSetTitle($hGUI, "", "GUI  " & $hGUI)
    GUICtrlCreateLabel("Label in GUI", 200, 0, 90, 20)
    GUICtrlSetBkColor(-1, 0xFFFF00)

    $hMdiChild = GUICreate("", 300, 200, 0, 0, -1, BitOR($WS_EX_WINDOWEDGE, $WS_EX_MDICHILD), $hGUI)
    WinSetTitle($hMdiChild, "", "MdiChild  " & $hMdiChild)
    GUICtrlCreateLabel("Label in MdiChild", 200, 0, 90, 20)
    GUICtrlSetBkColor(-1, 0x00FFFF)

    GUISetState(@SW_SHOW, $hGUI)
    GUISetState(@SW_SHOW, $hMdiChild)

    ConsoleWrite("====" & @CRLF)

    ConsoleWrite( _
            "> Parent/Ancestors of MdiChild window " & $hMdiChild & @CRLF & _
            "Reminder : $hGUI = " & $hGUI & @CRLF & _
            "Reminder : $hMdiChild = " & $hMdiChild & @CRLF & @CRLF & _
            "_WinAPI_GetParent = " & _WinAPI_GetParent($hMdiChild) & " (owner, not parent +++)" & @CRLF & @CRLF & _
            "_WinAPI_GetAncestor (Parent)   = " & _WinAPI_GetAncestor($hMdiChild, $GA_PARENT) & " (desktop)" & @CRLF & _
            "_WinAPI_GetAncestor (Root)     = " & _WinAPI_GetAncestor($hMdiChild, $GA_ROOT) & " (itself / $hMdiChild)" & @CRLF & _
            "_WinAPI_GetAncestor (Owner)    = " & _WinAPI_GetAncestor($hMdiChild, $GA_ROOTOWNER) & " (gui / $hGUI)" & @CRLF & _
            "")
    ConsoleWrite("====" & @CRLF)

    ConsoleWrite("- TEST 1 - ExStyles of $hMdiChild : 0x" & Hex(_WinAPI_GetWindowLong($hMdiChild, $GWL_EXSTYLE), 8) & @CRLF)
    _WinAPI_SetWindowLong($hMdiChild, $GWL_EXSTYLE, $WS_EX_MDICHILD)
    ConsoleWrite("- TEST 2 - ExStyles of $hMdiChild : 0x" & Hex(_WinAPI_GetWindowLong($hMdiChild, $GWL_EXSTYLE), 8) & @CRLF)

    ConsoleWrite("====" & @CRLF)

    Do
    Until GUIGetMsg() = -3

    GUIDelete($hMdiChild)
    GUIDelete($hGUI)
EndFunc   ;==>Example

 

results:

Quote

====
> Parent/Ancestors of MdiChild window 0x00000000015C0C3C
Reminder : $hGUI = 0x0000000000400B94
Reminder : $hMdiChild = 0x00000000015C0C3C

_WinAPI_GetParent = 0x0000000000400B94 (owner, not parent +++)

_WinAPI_GetAncestor (Parent)   = 0x000000000001000C (desktop)
_WinAPI_GetAncestor (Root)     = 0x00000000015C0C3C (itself / $hMdiChild)
_WinAPI_GetAncestor (Owner)    = 0x0000000000400B94 (gui / $hGUI)
====
- TEST 1 - ExStyles of $hMdiChild : 0x00000100
- TEST 2 - ExStyles of $hMdiChild : 0x00000140

====
 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

@mLipok As we noticed, AutoIt doesn't add the extended style $WS_EX_MDICHILD in a window created with the "fake" extended style $WS_EX_MDICHILD :

GUICreate(..., $WS_EX_MDICHILD)

Thanks to @funkey, we can see in his script how to create genuine MDI child windows which will have a $WS_EX_MDICHILD extended style (checked) . So probably Jon didn't want at all to indicate that AutoIt GUI's created with the fake $WS_EX_MDICHILD style were real MDI child windows, that's why he removed the $WS_EX_MDICHILD extended style indicated by the user, to create a non-child window instead.

As you know, real MDI child windows are confined in the client area of their MDI client window, which isn't the case of fake AutoIt $WS_EX_MDICHILD windows which are not confined at all etc...

Maybe this could be indicated in the help file : "though the user indicates $WS_EX_MDICHILD when creating the GUI, you won't retrieve this extended style if you check for it after the GUI creation"

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

Posted
2 hours ago, jpm said:

anyway I will add something in the doc about simulation

Thanks Jean-Paul, it will be useful to users who check for $WS_EX_MDICHILD after they create a GUI (indicating this extended style at creation) then wonder why it is not found anymore in the GUI extended styles after creation.

2 hours ago, jpm said:

By the way the @funkey script does not work under current version

You're right, here are the few changes required to make it work with newer versions of AutoIt :

Remove 8 lines :
#include <WinAPIEx.au3>
Global Const $IDC_ARROW = 32512
Global Const $WM_MDIGETACTIVE = 553
Global Const $WM_MDICREATE = 544
Global Const $WM_MDIACTIVATE = 546
Global Const $WM_MDITILE = 550
Global Const $WM_MDICASCADE = 551
Global Const $MF_ENABLED = 0

Add 2 lines :
#include <WinAPIRes.au3>
#include <WinAPISysWin.au3>

Also, IF you want the MDI frame window ($hGUI in our case) to be maximizable & resizable, change this line :

; Global $hGui = GUICreate("AutoIt MDI-Example by funkey", -1, -1, -1, -1, BitOR($WS_MAXIMIZE, $GUI_SS_DEFAULT_GUI))

Global $hGui = GUICreate("AutoIt MDI-Example by funkey", -1, -1, -1, -1, BitOR($WS_MAXIMIZE, $WS_OVERLAPPEDWINDOW))

Feature : to create a new MDI child window : Menu => File => New child
This will automatically add an entry in : Menu => Window (one of the MDI features)

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

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...