%U_SAVESETTINGS

Save application window settings to synergy.ini or synuser.ini

WTSupported in traditional Synergy on Windows

 

 

 

status = %U_SAVESETTINGS([flags])

or

xcall U_SAVESETTINGS([flags])

status

On Windows, true if the function is successful, or false if it is not. On UNIX, always returns false. On OpenVMS, always returns true. (^VAL)

flags

(optional) One or more of the following, combined using .BOR. or the vertical bar (|) operator, to indicate where to save window settings. If not passed, settings are saved to synuser.ini. (n)

D_APP_ALLUSERS

Save the settings to synergy.ini.

D_APP_STATE

Save the application window state.

D_APP_POS

Save the application position.

D_APP_SCALE

Save the scaling percentage.

D_APP_SIZE

Save the application height and width.

%U_SAVESETTINGS saves the state, position, scaling percentage, and size of the application window to synuser.ini or, if you pass D_APP_ALLUSERS, synergy.ini. For the size, %U_SAVESETTINGS saves the size at U_START or as of the last call to U_RESIZE. For state, position, and scaling percentage, %U_SAVESETTINGS saves current settings. Settings are saved to the section in the initialization file that’s labeled with the name of the currently executing .dbr file.

If the file (synergy.ini or synuser.ini) that Toolkit is attempting to write to does not exist, it will be created. The synergy.ini file will be created in the directory specified by SFWINIPATH if it’s set. If it isn’t set, synergy.ini will be created in the directory specified by DBLDIR. The synuser.ini file will be created in the user’s application data directory. For more information, see Synergy initialization files.

If %U_SAVESETTINGS fails (which causes status to be returned as false), you can use %SYSERR to retrieve the system-specific error code.

The following example saves the application size (as of U_START or the last U_RESIZE) to synergy.ini.

xcall u_savesettings(D_APP_SIZE|D_APP_ALLUSERS)

The next example does the same, but by calling U_RESIZE with the current application window height and width, it causes %U_SAVESETTINGS to save the current size of the application window to synergy.ini.

stack record
    wnd_handle  ,i4
    group rect  ,a
      left   ,i4
      top    ,i4
      right  ,i4
      bottom ,i4
    endgroup
    row_num  ,i4
    col_num  ,i4
;Get the window handle for the application window.
wnd_handle = %W_INFO(WIF_HWND, WID_APP) 
;Get coordinates for client area of application window.
xcall u_winmetrics(D_CLIENT_RECT, wnd_handle, rect) 
;Get number of last row.
row_num = %u_winmetrics(D_YTOROW, WID_APP, bottom-1) 
;Get number of last column.
col_num = %u_winmetrics(D_XTOCOL, WID_APP, right-1)
;Call U_RESIZE with current height & width so app window doesn't change)
xcall u_resize (row_num, col_num)  
;Save application window position and size to synergy.ini.
xcall u_savesettings(D_APP_SIZE|D_APP_ALLUSERS)