tk1 Posted November 7, 2016 Share Posted November 7, 2016 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 Link to comment Share on other sites More sharing options...
Jfish Posted November 7, 2016 Share Posted November 7, 2016 These functions are not being called with variables or strings for the paramters: fuServiceStartStop(stop) fuServiceStartStop(start) Try "start" or "stop" Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
tk1 Posted November 7, 2016 Author Share Posted November 7, 2016 Ah, ok, I feel stupid now -- forgot the quotes. Works great now! Thank you Jfish! tk1 Link to comment Share on other sites More sharing options...
Jfish Posted November 7, 2016 Share Posted November 7, 2016 Glad I could help. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now