CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2010
    Posts
    5

    VB 6.0 Application found active on Task Manager

    Hi.

    I have a simple VB 6.0 application that communicates over serial port. It consists only of a single Form.
    If I close this application by clicking the Close(Cross button in corner box), the application is still found running in Task Manager. However, terminating it with an "End" Statement in the event of a button removes it from task manager list also. However, the same End statement when added to the Event of Close does not work.

    What is the reason for this?

    How can I remove the Application from running in Task Manager, when the Cross button is pressed.

    Thanks.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: VB 6.0 Application found active on Task Manager

    Make sure that everything has completed tehir work, and then close your application with the Unload Me / End Statement

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: VB 6.0 Application found active on Task Manager

    Right. In this case I think you should also explicitly close the MSComm port like
    MSComm1.PortOpen = False
    in the Form_Unload() event.
    I know this "keep hanging in the task list" from an app of mine, if a communications operation is not considered complete at the time the form unloads. Closing the port explicitly should terminate any pending operation.

  4. #4
    Join Date
    Jan 2010
    Posts
    5

    Re: VB 6.0 Application found active on Task Manager

    Thanks for the reply.

    I forgot to mention in my earlier post that I am closing the Port just like the way you mentioned.

    I even give it enough time to close, that is run a while loop to ensure that the current state of the port is closed.

    Should I do anything else, like clear the buffers or something else?

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: VB 6.0 Application found active on Task Manager

    Usually VB does everything for you when the main form is closed... like releasing objects and variables.
    Try to put a button on and instead of "End", put "Unload Me" in the click handler and see if that works.
    I f you click the cross button the usual steps are:
    a) firing the QueryUnload() event to see if it is ok to quit and then
    b) firing the Unload() event to let the user perform final tasks.
    There should be no difference clicking the cross and clicking your own button.

Tags for this Thread

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

Featured