Jump to content

GUIExtender - Deprecated version


Melba23
 Share

Recommended Posts

  • 9 months later...

Hi Melba23 and thanks for your cool UDFs, here's a little question, is there a way to embed a child GUI inside an extendable section ? Here's a little test script, I have commented the lines that I would like to work but that unfortunately don't until now...

#include <GUIConstantsEx.au3>
#include "GUIExtender.au3"
#include "GUIScrollbars_Ex.au3"

Opt("GUIOnEventMode", 1)

$hGUI_1 = GUICreate("GUI Extender with Child GUI test", 300, 180, 100, 100)
GUISetBkColor(0xBBCCFF, $hGUI_1)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")

_GUIExtender_Init($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 0, 60)
GUICtrlCreateGroup(" 1 - Static ", 10, 10, 280, 50)
_GUIExtender_Section_Action($hGUI_1, 2, "", "", 270, 40, 15, 15, 0, 1) ; Normal button
_GUIExtender_Section_End($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 60, 110)
GUICtrlCreateGroup(" 2 - Extendable ", 10, 70, 280, 100)
;~ $childGUI = GUICreate("Child", 280, 100, 10, $WS_POPUP, -1, $hGUI_1)
;~ GUISetBkColor(0xAACF0C, $childGUI)
;~ GUISetState(@SW_SHOW, $childGUI)
;~ DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($childGUI), "hwnd", WinGetHandle($hGUI_1))
;~ _GUIScrollbars_Generate($childGUI, 2000, 0, 0, 0, Default, 7)
_GUIExtender_Section_End($hGUI_1)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState()

While 1
    Sleep(50)
WEnd
Func On_Exit()
    Exit
EndFunc   ;==>On_Exit
Link to comment
Share on other sites

  • Moderators

CodingCody37,

You mean like this? :huh:

#include <GUIConstantsEx.au3>
#include "GUIExtender.au3"
#include "GUIScrollbars_Ex.au3"
#include <WinAPI.au3>

Opt("GUIOnEventMode", 1)

$hGUI_1 = GUICreate("GUI Extender with Child GUI test", 300, 180, 100, 100)
GUISetBkColor(0xBBCCFF, $hGUI_1)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")

_GUIExtender_Init($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 0, 60)
GUICtrlCreateGroup(" 1 - Static ", 10, 10, 280, 50)
_GUIExtender_Section_Action($hGUI_1, 2, "", "", 270, 40, 15, 15, 0, 1) ; Normal button
_GUIExtender_Section_End($hGUI_1)

_GUIExtender_Section_Start($hGUI_1, 60, 110)
GUICtrlCreateGroup(" 2 - Extendable ", 10, 70, 280, 100)
_GUIExtender_Section_End($hGUI_1)

GUISetState()

$childGUI = GUICreate("Child", 280, 90, 10, 80, $WS_POPUP, -1, $hGUI_1)
GUISetBkColor(0xFFCCCC, $childGUI)
GUISetState(@SW_SHOW, $childGUI)
_WinAPI_SetParent($childGUI, $hGUI_1)
_GUIScrollbars_Generate($childGUI, 2000, 0, 0, 0, Default, 7)

While 1
    Sleep(50)
WEnd

Func On_Exit()
    Exit
EndFunc   ;==>On_Exit
M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

CodingCody37,

You mean like this? :huh:

M23

 

 

definitely ! The answer was very simple, my brain was focused on "putting the elements in the sections" and I've put the lines of code to mimic that without actually thinking at what I was writing lol ...it looks so clear and obvious now than I'm a bit ashamed hehe, thanks for the heads-up !

// I can see that my code even had a childGUI where I somehow deleted the "top" parameter by mistake, ty for the correction as well :-)

Edited by CodingCody37
Link to comment
Share on other sites

  • Moderators

CodingCody37,

If you have sections below the child GUI, you need to do a bit more:

<snip>

All clear I hope. :)

M23

Edited by Melba23
Old Beta code removed

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

CodingCody37,

 

You're anticipating questions, I guess that's called being experienced

Thanks - and I have come up with another scenario where you will need to do even more. If the child GUI has retractable sections above it we will need to relocate the child GUI to its new position if they are extended/retracted. I have some working code to do just that - but I will see if I can make it easier for the coder by getting it all into a single function. Stay tuned! :)

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Hi,

Here is modified UDF and example which will cater for embedded child GUIs:

<snip>

Comments welcomed. :)

M23

Edited by Melba23
Old Beta code removed

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

There is small issue with GUI.

EDIT: I attach png where you can see how scrollbar is not correctly refreshed/repainted.

post-10673-0-57314300-1408484733.png

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

Link to comment
Share on other sites

great ! gonna look at this tomorrow, off to bed right now. It's nice that you took it a little further, because as you've guessed, embedding GUIs to retractable sections is really useful, especially in my case where I needed to use your easy scrollbars, thus I needed that kind of child GUI !

Edited by CodingCody37
Link to comment
Share on other sites

  • Moderators

mLipok,

That is an artefact caused by the overlap of the group frame and the scrollbar. I already redraw the child GUI - I would have thought that the scrollbars would have been redrawn too, but evidently not. Anyway, if you reduce the child height by 10 pixels it no longer appears - and how often will there be overlapping group frames and scrollbars anyway? ;)

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Just a quick note about mLipok's screenshot, this is also a typical case where your NoFocusLines UDF is handy, because if you watch the tiny arrow button used to develop or retract the section, with the dotted selection lines around it looks wrong (because of the small size), so getting rid of them is good in this case ^^

Link to comment
Share on other sites

Hi,

Here is modified UDF and example which will cater for embedded child GUIs:

<snip>

Comments welcomed. :)

M23

 

Just tested and I must say ..nice ! And thanks because that's a piece of code that would obviously have been needed a moment or another, and you just made it even simplier by adding it to the UDF itself, allowing us to build even more complicated apps with minimum thinking. Thumbs up!

 

I could go crazy and build a "La Vache qui rit" GUI :

ndo0vd.jpg

 

(in other words, infinite nested retractable stuff lol... sorry I'm french and that's a thing coming to my mind right away when thinking of "Mise en abyme" !)

 

I remember once doing this with operating systems and virtual machines.. installing win98 on WinXP on..Win7 host haha...just for fun

Edited by Melba23
Link to old Beta removed
Link to comment
Share on other sites

  • Moderators

CodingCody37,

Glad you like it. I will write some header info for the added functions and release a new version in the next few days. :)

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

CodingCody37 (and anyone else reading),

Here is a more polished Beta version with even easier syntax which mirrors the existing function for UDF-created controls:

<snip>

Please comment, report bugs, etc. :)

M23

Edited by Melba23
Removed Beta code

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Back again,

There was a problem with minimizing and restoring the GUI with the earlier code. A lot of testing shows that you must NOT use the parent parameter when creating the child GUI, or else you do not get a $GUI_EVENT_RESTORE message. I have also merged the code for embedding UDF-created controls and child GUIs into a single function - all you need to do is set a parameter to tell the UDF what it is dealing with - as you can see here:

<snip>

As usual, comments welcome from any testers. :)

M23

Edited by Melba23
Beta code removed

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

[New version] - 24 Aug 14

Added: Ability to embed child GUIs. Child GUIs must be created with the $WS_POPUP style and the _WinAPI_SetParent function used, not the "parent" parameter of GUICreate.

This is a script-breaking change. The old _GUIExtender_UDFCtrlCheck function has been replaced with the new _GUIExtender_HandleCheck function which deals with both UDF-created controls and child GUIs, Just replace the old function name with the new one - no other syntax changes needed.

New UDF and examples in zip in first post. :)

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 5 months later...

Hello,

I'm a new user on this forum, I used to be on the French autoit forum, but even if I'm not very good with my English I need your help.
 
First thank you for your UDF, very useful.
I'm making some lab and I try to make Guiextender work.
 
I'm new to Autoit.

Anyway I'll try to combine resources.udf with your udf but I have somes bugs.

>Resources UDF link

Well here my script : and yeah I borrowed >from it on your topic for trying.

This intend to be a network checkup.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=test.exe
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_File_Add=red.bmp, rt_bitmap, BMP_1
#AutoIt3Wrapper_Res_File_Add=green.bmp, rt_bitmap, BMP_2
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>
#include "GUIExtender.au3"
#include "resources.au3"

Opt("GUIOnEventMode", 1)

Local $Button, $iThis_Section

$hGUI = GUICreate("Vertical", 300, 170, 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")

_GUIExtender_Init($hGUI)

$Section1 = _GUIExtender_Section_Start($hGUI, 0, 90)

Global $IMGTest1 = GUICtrlCreatePic("", 15, 20, 25, 25)
Global $Test1 = GUICtrlCreateLabel("Test1", 56, 20, 361, 24)
Global $IMGTest2 = GUICtrlCreatePic("", 15, 50, 25, 25)
Global $Test2 = GUICtrlCreateLabel("Test2", 56, 50, 361, 24)


$Button = _GUIExtender_Section_Action($hGUI, 2, "", "", 50, 75, 175, 15, 0, 1)

_GUIExtender_Section_End($hGUI)

$Section2 = _GUIExtender_Section_Start($hGUI, 90, 80)
$List1 = GUICtrlCreateList("", 10, 98, 280, 70)
_GUIExtender_Section_End($hGUI)
_GUIExtender_Section_Extend($hGUI, 0, False)

GUISetState()

$hBmp1 = _ResourceGet("BMP_1", $RT_BITMAP)
$hBmp2 = _ResourceGet("BMP_2", $RT_BITMAP)
_SetBitmapToCtrl($IMGTest1, $hBmp1)
_SetBitmapToCtrl($IMGTest2, $hBmp1)


Local $IP1 = "www.google.com"
$result = WMI_Ping($IP1,32,false,0,true)
If NOT @ERROR Then
    _SetBitmapToCtrl($IMGTest1, $hBmp2)
    GUICtrlSetData($Test1,"Accès à " & $IP1 & " en " & $result & " ms")
Else
    GUICtrlSetData($Test1,"Echec ping vers " & $IP1)
EndIf

Local $IP2 = "www.sdgbgwdfhg.com"
$result = WMI_Ping($IP2,32,false,0,true)
If NOT @ERROR Then
    _SetBitmapToCtrl($IMGTest2, $hBmp2)
    GUICtrlSetData($Test2,"Accès à " & $IP2 & " en " & $result & " ms")
Else
    GUICtrlSetData($Test2,"Echec ping vers " & $IP2)
EndIf

While 1
    Sleep(100)
WEnd

Func WMI_Ping($sAddress = "127.0.0.1", $iBufferSize = 32, $bNoFragmentation = False, $iRecordRoute = 0, $bResolveAddressNames = False, $sSourceRoute = "")
    Local $colItems = "", $strComputer = "localhost", $strStatusCode = 0, $strResponseTime = 0, $Output = ""
    Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    Local $sQuery = "SELECT * FROM Win32_PingStatus WHERE "
    $sQuery &= "address = '" & $sAddress & "' "
    $sQuery &= "AND BufferSize = " & $iBufferSize & " "
    $sQuery &= "AND NoFragmentation = " & $bNoFragmentation & " "
    $sQuery &= "AND RecordRoute = " & $iRecordRoute & " "
    $sQuery &= "AND ResolveAddressNames = " & $bResolveAddressNames & " "
    $sQuery &= "AND SourceRoute = '" & $sSourceRoute & "'"

    $colItems = $objWMIService.ExecQuery($sQuery, "WQL", 0x10 + 0x20)

    If IsObj($colItems) Then
        ConsoleWrite("Object Name: " & ObjName($colItems) & @CRLF)
        For $objItem In $colItems
            $strResponseTime = $objItem.ResponseTime
            $strStatusCode = $objItem.StatusCode
        Next

        If $strStatusCode <> 0 Then
            Return SetError(1,0,$strStatusCode)
        Else
            Return $strResponseTime
        EndIf
    Else
        Return SetError(2,0,0)
    EndIf

EndFunc   ;==>WMI_Ping

Func On_Exit()
    Exit
EndFunc 

You can download it here.

Well my problem is when I unhide my gui, my controls go away

First :

15o9sh5.png

Then when I unhide

kd4vpd.png

My green square become huge et my red square disapear.

Thank you for your help

Link to comment
Share on other sites

  • Moderators

Stormgrade,

If by "hide/unhide" you mean "minimize/restore" then you need to call the _GUIExtender_Restore function when a $GUI_EVENT_RESTORE event occurs. When I add that the GUI behave normally:

$hGUI = GUICreate("Vertical", 300, 170, 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit")
GUISetOnEvent($GUI_EVENT_Restore, "_GUIExtender_Restore") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I hope that solves your problem. :)

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...