Jump to content

adding a progress bar during a function execution


ddeerr
 Share

Recommended Posts

Hi,

I don't find how to add a progress during a function execution without implementing the function code :\

I found that a functionnality was create to do that while files are copied (shellFileOperation.au3) but i don't understand the DLLcreate....

Do you know if there is another way much simply to do that ?

Tx

Link to comment
Share on other sites

I am not sure exactly what you mean, but you can make and update your own progress bars easily like this...

#include <GUIConstants.au3>

$frmProgressBar = GUICreate("Progress Bar Testing", 301, 201, 193, 115)
;Create Progress Bar
$progressTest = GUICtrlCreateProgress(48, 80, 150, 17)
GUISetState(@SW_SHOW)
$i = 1
While 1
    $i = $i + 1
    ;update progress bar every 5 passes
    If Int($i/5) <= 100 Then
        GUICtrlSetData($progressTest, Int($i/5)) 
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Progress bars can have a value between 0 and 100. This is all in the helpfile, more or less. Or am I just way off base?

Link to comment
Share on other sites

  • 4 years later...

Hi all!

Need progress bar for function too. Is it possible?

Function example:

If UninstallApp($Computer, $App) Then
    MsgBox(0, "", "Uninstalled.")
Else
    MsgBox(0, "", "Application not found.")
EndIf

Func UninstallApp($strComputer, $strAppName)


    If @error Then
UninstallApp = False
    Else
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$colSoftware = $objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE name = '" & $strAppName & "'")
For $objSoftware in $colSoftware
            $objSoftware.Uninstall()
UninstallApp = True
Next
GUIDelete($hSplash)
EndIf
EndFunc
Edited by HaeMHuK
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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