Results 1 to 3 of 3

Thread: kedaman

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    kedaman,

    how do i tell my program that a shutdown attempt is occuring.

    Thanks,
    ande211

  2. #2

    Windows Shutdown Notifications

    Well, Kedaman, you have succeeded AGAIN to confuse everyone. At least you are semi-right, but you haven't given enough information (I think) to make any use of this.

    I will assume that a shutdown event in ande211's message means the Windows shutdown. (Start|Shutdown)

    Very simply, without using any API stuff, the one event on your forms that helps you to know that you form is shutting down is called Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer).

    This is where you want to evaluate what kind of unload is being processed. If you look in the VB Help for QueryUnload you will see that the UnloadMode argument provides you with lots of information about HOW your program is being closed.

    Code:
    Constant          Value  Description 
    vbFormControlMenu 0      The user chose the Close command from the Control menu on the form. 
    
    vbFormCode        1      The Unload statement is invoked from code. 
    vbAppWindows      2      The current Microsoft Windows operating environment session is ending. 
    vbAppTaskManager  3      The Microsoft Windows Task Manager is closing the application. 
    vbFormMDIForm     4      An MDI child form is closing because the MDI form is closing. 
    vbFormOwner       5      A form is closing because its owner is closing
    The one you will probably be interested in is vbAppWindows

    If you examine the UnloadMode = vbAppWindows then you will be able to tell exactly how your program is shutting down.

    Senior Systems Architect/Programmer

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I'm confusing everyone? That's the last thing I want! If this is about the doevents thing, ande211, then the form will know. It will also know when user closes it. If you really want the track the shutdown attempt, I think Jaguar have the right code. But I don't know what you mean, you posted "kedaman", and I suppose it was about the doevents. Sorry if I really was confusing anybody.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width