-2

I have an application and I am facing some serious problems. This application is preventing the user to log off. Each time when log off it crashed. How to log off properly?

Any suggestions will be well received.

Thanks.

A. Ne
  • 9
  • 1

2 Answers2

0

write a bat file that calls two programs, the first is a .net C# console app that runs this code in it's main method:

foreach (var process in Process.GetProcessesByName("apppreventinglogoff.exe"))
{
    process.Kill();
}

then the bat file can call "logoff.exe"

  • I didn't down vote you, but it could be because your solution is not really relevant in the case of an SAP Business One Add-On (which I *think* is the scenario OP is referring to). – Overhed May 10 '16 at 16:04
0

Assuming your application is an SAP Business One Add-On, it sounds like you're not handling the SAP application close/shut-down events:

obj.SBO_Application.AppEvent += new _IApplicationEvents_AppEventEventHandler(SBO_AppEvent);

Then in your SBO_AppEvent method you'd do something like this:

switch(EventType)
{
   case SAPbouiCOM.BoAppEventTypes.aet_ServerTermination:       
       System.Windows.Forms.Application.Exit();
       break;
   case SAPbouiCOM.BoAppEventTypes.aet_ShutDown:
       System.Windows.Forms.Application.Exit();
       break;
}
Overhed
  • 1,289
  • 1
  • 13
  • 41