How Do I know if The User is Trying to Shut Down His Machine

Discussion in 'AutoCAD' started by matt_1ca, Mar 7, 2005.

  1. matt_1ca

    matt_1ca Guest

    I like to know if there is a way I can know from my code if the user is trying to shut down his machine.

    Our database administrator has given me access to a SQL Server database but the speed whereby the information is
    retrieved is not acceptable at all. Because this information is used by AutoCAD the slowness in the SQL Server side has had a very bad effect on the timeliness that AutoCAD should be receiving and processing the information.

    To remedy the problem I have written a VB program that automatically loads itself when the user boots his machine to extract data from that SQL Server database which has been too slow in retrieving information.

    The objective of the program is to remedy this slowness by populating an MS Access database residing in the users’ own machine with all the information that the program will extract from the SQL Server database on the background without the user knowing anything about what is happening so that in the end after the program has populated the MS Access with all important historical information he will be accessing all his information from the MS Access and use the SQL Server only for new information that gets added on a daily basis (still to be retrieved by the hidden program I have written that loads at startup).

    If I know that the user is trying to shut down his machine I can design the program to gracefully exit so that for example it will be able to programmatically disconnect from the databases, then unload itself from memory.

    Thank you for all the kind help you can extend in this regard.

    Matt
     
    matt_1ca, Mar 7, 2005
    #1
  2. To remedy the problem I have written a VB program
    The obvious solution is to not allow this application to
    terminate. If it is hidden and has no visible interface,
    then it will run until the user closes windows. You can
    then use any notification that fires when the application
    is closed such as the terminate event of a class module.

    For applications that have forms, the QueryUnload event
    of the form object has a parameter that tells if the unload
    is occuring because the user is shutting down windows.
     
    Tony Tanzillo, Mar 7, 2005
    #2
  3. matt_1ca

    HJohn Guest

    I would try to find out what is slowing SQL, and fix it rather than creating a copy on Access. I work with SQL to produce and manage BOM and keep inventory, so far I am very happy with its performance (SQL 2000). I would think that if your company invested on SQL it must have been for its advantages over Access, so what is the point of having SQL if the work is being done by Access.
     
    HJohn, Mar 7, 2005
    #3
  4. matt_1ca

    matt_1ca Guest

    Thanks Tony,

    This sounds like a truly elegant approach, I will go and try it.

    Matt
     
    matt_1ca, Mar 7, 2005
    #4
  5. matt_1ca

    matt_1ca Guest

    I agree with you -- however as you may know there are also political issues involved in a company.

    Although I understand and have been using SQL Server for years -- I do not want to cross that border that can spell disharmony -- between different departments -- for now the Administrator does not look comfortable when I am around but then again that is a different story.

    Matt
     
    matt_1ca, Mar 7, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.