Page 1 of 1

OnExit Func Inside a Class

Posted: 02 Feb 2019, 17:46
by Delta Pythagorean
With the "new" OnExit func, I want to be able to exit the script and have the OnExit function to be a function that's inside a class (Without using __Delete).

For example:

Code: Select all

Class StartupClass {
	__New() {
		OnExit() ; What goes in here?
	}
}

Class ExitClass {
	OnExitFunction() {
		MsgBox, Closing down!
	}
}

Re: OnExit Func Inside a Class  Topic is solved

Posted: 02 Feb 2019, 17:51
by Delta Pythagorean
Nevermind, I need to read the Docs more often.
AHK Docs wrote:

Code: Select all

; Register an object to be called on exit:
OnExit(ObjBindMethod(MyObject, "Exiting"))

class MyObject
{
	Exiting()
	{
		MsgBox, MyObject is cleaning up prior to exiting...
		/*
		this.SayGoodbye()
		this.CloseNetworkConnections()
		*/
	}
}