Local ox As MessageHandler OF MyFunctions.prg ox = CreateObject( "MessageHandler" ) ox.Mb( "TestMessage", 16, "TestTitle", 1000 ) ox = NULL Define Class FunctionBaseClass As Session Protected SomeSound Protected Function Init *-- Do Someting usefull here *-- this will be common to all the functions EndFunc Function SomeSound_Access() Return This.GetSoundOfTheDay() EndFunc Protected Function GetSoundOfTheDay() *-- Return something mabe from a file or anyting else *-- Just return 7 for now MessageBox("Sound Access") Return 7 EndFunc Protected Function Sound() Local luSound luSound = This.SomeSound If VarType(luSound) = "N" ?? chr(luSound) Endif EndFunc EndDefine Define Class MessageHandler As FunctionBaseClass Function MB( tcMessage, tnButtons, tcTitle, tnTimeOut ) This.Sound() RETURN MessageBox( tcMessage, tnButtons, tcTitle, tnTimeOut ) EndFunc EndDefineBy doing it this way, you take advantage of intellisense. This is all about code re-use.
>FUNCTION MB( tcMessage, tnButtons, tcTitle, tnTimeOut ) > ?? chr(7) > RETURN MessageBox( tcMessage, tnButtons, tcTitle, tnTimeOut ) >>then anywhere in my code I want MessageBox, I would just "=MB(...)"