I’m having a problem with users logging in with multiple instances. I can halt their log in, but i am looking for a way to force an exit of the system from within the code itself. Ultimately a way to force an Alt+F4 or a Alt - F - X. Though i am not sure if there are any functions or codeunits already within the program that could handle such a thing.
Hi Bryan, I am not really sure if my suggest will work, but you should have a look at Codeunit 1, Function LogInStart, which gets called everytime a users logs into Navision. I guess you can put in some kind of validation if there exists already a sessions for this users checking the records in Table 2000000009 Sessions and then raising an error… Saludos Nils
Hi Bryan (and Nils), I don’t think the above suggestion (ERROR) will force a complete exit from the system. But using the Windows Script Host Object Model (WshShell) you might be able to automate an Alt+F4 keyboard-sequence (in stead of an ERROR), thus forcing an exit. Search for “Sendkey” for more info. Haven’t tried it, though - just a thought
Steffen’s right. Raising an ERROR in Codeunit 1 is already too late. The User is already logged in to the Database and consuming 1 User License. The SendKeys Script solution should however work.
Hi Brian, Please try this code, add it to loginstart sessionRec , record, session SessionRec.RESET; SessionRec.setrange(“USer id”,userid) if Sessionrec.count > 1 then SHELL(‘C:\WINDOWS\SYSTEM32\taskkill.exe /f /im fin.exe /t’);
And supposing I am starting a second session on the same computer, will that command always kill the fin.exe process I have just started or is there a chance that it will kill the first one?
[^] Hi nelson, I never try it before… [:o][:o][:o][:o][:o] p.s. anyone can help me in user portal… please see my question on e-commerce forum please please
[^] Hi nelson, I never try it before… [:o][:o][:o][:o][:o] p.s. anyone can help me in user portal… please see my question in e-commerce forum Thanks in advance
You can use SendKeyes in LoginStart in codeunit 1. Works great. Search the forums for sendkeyes for more info. /Lars
To be more precise (sorry Lars) use Windows Scripting Host- Core Functionality in Windows XP and needs to be installed on other Operating Systems.
quote:
To be more precise (sorry Lars) use Windows Scripting Host- Core Functionality in Windows XP and needs to be installed on other Operating Systems.
Originally posted by tb@softsys.at - 2005 May 13 : 20:42:31
Exactly what I meant[:)]