KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Automatically closing the 4D Server Administration Window on the Server
PRODUCT: 4D | VERSION: 13.3 | PLATFORM: Mac & Win
Published On: December 2, 2013

The 4D Server Administration Window increases resource consumption in order to keep itself updated and there is rarely a situation where the 4D Server Administration Window needs to be left open for a long duration of time. It is therefore recommended to keep the 4D Server Administration Window closed in order to maximize performance for the 4D Server: https://kb.4d.com/assetid=76159

The following code creates a stored procedure named "AdminWinCloser" and uses HIDE WINDOW to close the 4D Server Administrion Window every 1 minute:

// Method: UTIL_CloseAdminWindow
// Description: Utility method to create a stored
// procedure to close the admin window
// Parameters: NONE


ARRAY LONGINT($alWnd;0)
C_LONGINT($vlWnd;$vlProc;$vlProcState;$vlProcTime;$vlServProc;$vlTickDelay)
C_STRING(80;$vsProcName)
C_STRING(80;$vsWndTitle)
C_STRING(80;$vsMethodName)
C_STRING(80;$vsCmd)
C_BOOLEAN(<>bQuit)

$vsMethodName:=Current method name
$vlTickDelay:=60*60 // 1 minute

If (Count parameters=1)
   C_STRING(80;$1)
   $vsCmd:=$1
End if

Case of
   : ($vsCmd="CloseAdminWindow")
   WINDOW LIST($alWnd)
   For ($vlWnd;1;Size of array($alWnd))
      $vsWndTitle:=Get window title($alWnd{$vlWnd})
      $vlProc:=Window process($alWnd{$vlWnd})
      PROCESS PROPERTIES($vlProc;$vsProcName;$vlProcState;$vlProcTime)
      If ($vsWndTitle="@4D Server Administration@")
         If ($vsProcName="User Interface")
             // Client process is named '4D Server Administration'
             // Server process is named 'User Interface'
            HIDE WINDOW($alWnd{$vlWnd})
         End if
      End if
   End for
   : ($vsCmd="StoredProcedure")
   Repeat
       // Actual Stored Procedure
      EXECUTE METHOD($vsMethodName;*;"CloseAdminWindow")
      DELAY PROCESS(Current process;$vlTickDelay)
   Until (<>bQuit)
Else
    // close admin window on the server
   $vlServProc:=Execute on server($vsMethodName;1024*1024;"AdminWinCloser";"StoredProcedure";*)
End case


There are no parameters needed; just save it as UTIL_CloseAdminWindow and run it like this:

UTIL_CloseAdminWindow


To stop the stored procedure set <>bQuit to True and call RESUME PROCESS (or wait the 1 minute delay for the stored procedure to resume and quit after setting <>bQuit to True).