• Sign-on Logging (Best Practices) (VB6)

    Author
    Topic
    #373713

    I have a couple apps I built in VB6 for which I created a log file recording log-in’s and log-out’s and the times they occurred for each user. The problem I’m running into is that it works fine when the user gracefully logs out. I also had a routine in my UI that allows administrators to see who is logged into the system currently. This part is simple, it looks for any entry that has a log-in time recorded and the log-out time is null.

    Interestingly, we seem to have a lot of users that don’t log out gracefully for whatever reason. Has anyone else delt with this issue? It’s almost as if I would have to have another application running in the background that keeps handshaking somehow with the client to determine if anyone is still home.

    I’m interested if anyone else has done anything like this and how the problem was resolved when the user doesn’t shut down by normal means.

    Viewing 1 reply thread
    Author
    Replies
    • #601660

      How can a use *not* log out gracefully? confused

      Do you mean your app dies before they can correctly log out? Assuming your code that writes the log-out time stamp is this same app, it wouldn’t be able to do that action if it didn’t end gracefully. I assume you have that code in some ‘close’ or ‘shutdown’ type of event where you do clean up before shutting down.

      I’m sure this isn’t news to you, but I’m not clear on the other ways a user can exit your program correctly (w/o a crash) and not cause your logging code to get run. Since you said there are quite a few users doing this, then if you know how they’re exiting, you might be able to prevent them from doing that action. (Or better yet determine why your code isn’t detecting a shut down.)

      Deb doh

      • #601742

        This is something I didn’t think I would have to deal with, actually, until it went into production. You are correct, I have it in the Form Terminate Event.

        There is a large user population, some have really poor computers that will hang (not just my app) and they do a control alt delete and end task to bail out of it. We upgraded the pc’s of several users and I don’t think this is an issue so much. The real problem is that we are running the program off a Citrix server which has a timeout interval set. This will log the user out of Citrix after no activity is received in a few minutes. This also terminates any open applications.

    • #601789

      Mike, Have you tried putting the logout code in the QueryUnload event? That event will run even if the App is closing because of Windows shutting down, so maybe it will run if the reason for closing is a Citrix timeout.

      • #601820

        HI there Dottie

        You know what, I’ve seen that event but never paid attention to it I guess because I’ve never knew what it did. You’re saying that if Citrix is shutting down an application, or if if someone shuts down an application using the End Task in Windows, this event will still fire?

        • #601877

          Hi Mike,
          Yes, that is the way QueryUnload is supposed to work. It has an UnloadMode parameter that you can check to see why the whether the form is about to be unloaded: due to code, the user clicking the X (control box), Windows shutting down, or the Task Manager End Task. You can set the Cancel parameter to True to prevent unloading if the mode is not the graceful exit you want. I’m just not sure if Citrix shutting the application down on a timeout will be treated the same way as End Task or Windows shutdown.

          • #601956

            It is certainly worth a try, Thanks Dottie. I’ll let you know what I find.

          • #605058

            Dottie, I wanted to get back to you on this (an for anyone else that is interested). This worked great, and it executes even during a Citrix timeout.

            Thanks again for your help.

          • #606707

            I just wanted to update this thread, correcting that the termination code in the QueryUnload event does not fire during a Citrix time out. I tried it initially and I thought it worked. I don’t know what I must have been looking at. Anyhow, this technique will come in handy on any future non-Citrix apps that I develop.

    Viewing 1 reply thread
    Reply To: Sign-on Logging (Best Practices) (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: