tk1

Error: undefined function

4 posts in this topic

Hello,

I'm getting "error: stop(): undefined function." when I call the function fuServiceStartStop the first time, and "error: start(): undefined function." when I call the function the second time, but I cannot understand why.  Stop is not a function, it's a parameter I'm feeding to the function.  Here's my code:

 

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <StaticConstants.au3> ;Label, Pic, Icon
#include <WindowsConstants.au3> ;Gui extended style
#RequireAdmin

Opt("GUIOnEventMode", 1) ;Change to OnEvent mode

Global $RestartServ = GUICreate("RServ", 300, 200, -1, -1, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "fuClose")
GUICtrlCreateLabel("To reset the service, click Reset.", 15, 15, 280, 30, $SS_LEFT, -1)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetBkColor(-1, "-2")
Global $btnReset = GUICtrlCreateButton("Reset", 110, 70, 79, 29, $BS_CENTER, -1)
GUICtrlSetOnEvent(-1, "fuReset")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUISetState(@SW_SHOW, $RestartServ)

While 1

WEnd

Func fuClose()
    Exit
EndFunc   ;==>fuClose

Func fuReset()
    fuServiceStartStop(stop)
    fuServiceStartStop(start)
    fuClose
EndFunc   ;==>fuReset

Func fuServiceStartStop($sFlag)
    RunWait(@ComSpec & " /c sc.exe " & $sFlag & " spooler", @SystemDir, @SW_HIDE)
EndFunc   ;==>fuServiceStartStop

 

Can anyone tell me why?

Thanks,

tk1

Share this post


Link to post
Share on other sites



Ah, ok, I feel stupid now -- forgot the quotes.

Works great now!  Thank you Jfish!

 

tk1

Share this post


Link to post
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