Have you users which are using same PC for work? (for example barcode reader with Win CE connected to the terminal server?) Do you need show the login form after previous user close the navision? Or you want to simplify the close-open process after importing the objects?
There is simple way how to do it:
Var
Ending : Boolean;
Text001 : TextConst 'ENU=Are you sure to close the Navision?';
TextLogout : Text Const 'ENU=%sdz%s1';
Form - OnQueryCloseForm() : Boolean
BEGIN
IF Ending THEN EXIT(TRUE);
IF CONFIRM(Text001,TRUE) THEN BEGIN
SendLogout;
EXIT(TRUE);
END ELSE
EXIT(FALSE);
END;
function SendLogout();
Var
Wsh : Automation 'Windows Script Host Object Model'.IWshShell_Class
BEGIN
IF ISCLEAR(Wsh) THEN
IF NOT CREATE(Wsh) THEN
EXIT;
Ending := TRUE;
Wsh.SendKeys(TextLogout);
END;
Remember, that you must localize the string (it is only string with hotkeys for the menu items)
f - File
b - Database
c - Close
1 - last opened DB and company
If users are using barcode scanners, you can print them barcode with username (or with user name and password and correct number of CR/LF for example in PDF-128 format) and they can easily logout from navision (using only ESC and Enter) and another user can login fastly through scanning the barcode... without typing the user name and password...
Of course you can use another procedure if you are using Windows Authentication...
The class IWshShell_Class is used, because is working on both Win2k and Win XP (may be you cannot enter it directly, because there is no in the seletion on Win XP - than select another, export as text, change the GUID to Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}:'Windows Script Host Object Model'.IWshShell_Class" and import back.