$PBExportHeader$n_application.sru forward global type n_application from nonvisualobject end type end forward global type n_application from nonvisualobject autoinstantiate end type type prototypes Function boolean ShowWindow ( & longptr handle, & long ncmdshow & ) Library "user32.dll" end prototypes type variables String is_company = "Topwiz Software" end variables forward prototypes public function integer of_setreg (string as_subkey, string as_entry, string as_value) public function integer of_setreg (string as_entry, string as_value) public function string of_getreg (string as_subkey, string as_entry, string as_default) public function string of_getreg (string as_entry, string as_default) public function string of_getappname () public subroutine of_showwindow (ref window aw_window, windowstate ae_state) public function string of_getcompany () end prototypes public function integer of_setreg (string as_subkey, string as_entry, string as_value);// ----------------------------------------------------------------------------- // SCRIPT: n_application.of_SetReg // // PURPOSE: This function sets parameters in the registry. // // ARGUMENTS: as_subkey - Optional subkey // as_entry - Entry name // as_value - Value to be stored // // RETURN: Result of RegistrySet // // DATE CHANGED BY DESCRIPTION OF CHANGE / REASON // ---------- ---------- ----------------------------------------------------- // 02/17/2010 RolandS Initial creation // ----------------------------------------------------------------------------- String ls_regkey // build registry key name ls_regkey = "HKEY_CURRENT_USER\Software\" ls_regkey += is_company + "\" + of_GetAppName() If Len(as_subkey) > 0 Then ls_regkey += "\" + as_subkey End If // set value in initialization source Return RegistrySet(ls_regkey, as_entry, as_value) end function public function integer of_setreg (string as_entry, string as_value);// ----------------------------------------------------------------------------- // SCRIPT: n_application.of_SetReg // // PURPOSE: This function sets parameters in the registry. // // ARGUMENTS: as_entry - Entry name // as_value - Value to be stored // // RETURN: Result of RegistrySet // // DATE CHANGED BY DESCRIPTION OF CHANGE / REASON // ---------- ---------- ----------------------------------------------------- // 02/17/2010 RolandS Initial creation // ----------------------------------------------------------------------------- Return this.of_SetReg("", as_entry, as_value) end function public function string of_getreg (string as_subkey, string as_entry, string as_default);// ----------------------------------------------------------------------------- // SCRIPT: n_application.of_SetReg // // PURPOSE: This function gets parameters from the registry. // // ARGUMENTS: as_subkey - Optional subkey // as_entry - Entry name // as_value - Default value if none found // // RETURN: The value stored in the registry. // // DATE CHANGED BY DESCRIPTION OF CHANGE / REASON // ---------- ---------- ----------------------------------------------------- // 02/17/2010 RolandS Initial creation // ----------------------------------------------------------------------------- String ls_regkey, ls_regvalue // build registry key name ls_regkey = "HKEY_CURRENT_USER\Software\" ls_regkey += is_company + "\" + of_GetAppName() If Len(as_subkey) > 0 Then ls_regkey += "\" + as_subkey End If // get value from initialization source RegistryGet(ls_regkey, as_entry, ls_regvalue) If ls_regvalue = "" Then ls_regvalue = as_default End If Return ls_regvalue end function public function string of_getreg (string as_entry, string as_default);// ----------------------------------------------------------------------------- // SCRIPT: n_application.of_SetReg // // PURPOSE: This function gets parameters from the registry. // // ARGUMENTS: as_entry - Entry name // as_value - Default value if none found // // RETURN: The value stored in the registry. // // DATE CHANGED BY DESCRIPTION OF CHANGE / REASON // ---------- ---------- ----------------------------------------------------- // 02/17/2010 RolandS Initial creation // ----------------------------------------------------------------------------- Return this.of_GetReg("", as_entry, as_default) end function public function string of_getappname ();// ----------------------------------------------------------------------------- // SCRIPT: n_application.of_GetAppName // // PURPOSE: This function returns the application name. // // RETURN: Applicaton name. // // DATE CHANGED BY DESCRIPTION OF CHANGE / REASON // ---------- ---------- ----------------------------------------------------- // 12/05/2006 Roland S Initial creation // ----------------------------------------------------------------------------- String ls_appname Application la_app la_app = GetApplication() If la_app.DisplayName = "" Then ls_appname = WordCap(la_app.AppName) Else ls_appname = WordCap(la_app.DisplayName) End If Return ls_appname end function public subroutine of_showwindow (ref window aw_window, windowstate ae_state);// this function sets the windowstate Integer li_cmdshow CHOOSE CASE ae_state CASE Maximized! li_cmdshow = 3 CASE Minimized! li_cmdshow = 2 CASE Normal! li_cmdshow = 1 END CHOOSE ShowWindow(Handle(aw_window), li_cmdshow) aw_window.SetFocus() end subroutine public function string of_getcompany ();// ----------------------------------------------------------------------------- // SCRIPT: n_application.of_GetCompany // // PURPOSE: This function returns the company name. // // RETURN: Company name. // // DATE CHANGED BY DESCRIPTION OF CHANGE / REASON // ---------- ---------- ----------------------------------------------------- // 12/05/2006 Roland S Initial creation // ----------------------------------------------------------------------------- Return is_company end function on n_application.create call super::create TriggerEvent( this, "constructor" ) end on on n_application.destroy TriggerEvent( this, "destructor" ) call super::destroy end on
File: n_application.sru
Size: 6425
Date: Thu, 14 Jul 2022 19:38:02 +0200
Size: 6425
Date: Thu, 14 Jul 2022 19:38:02 +0200
- nonvisualobject autoinstantiate n_application(sru)
- of_getappname () returns string
- of_getcompany () returns string
- of_getreg (string as_entry, string as_default) returns string
- of_getreg (string as_subkey, string as_entry, string as_default) returns string
- of_setreg (string as_entry, string as_value) returns integer
- of_setreg (string as_subkey, string as_entry, string as_value) returns integer
- of_showwindow (ref window aw_window, windowstate ae_state)