Shell launch / Process End 
Author Message
 Shell launch / Process End

Hi,
   I have a simple VB 6 app that I run two ways.  One, I launch it directly,
do what I need, then Exit.  The process appears in Task Manager, then
disappears upon exiting.  The second way I launch the app is through a Shell
command with command line arguments from another app.  My app looks for
command line arguments on callup and does the same thing I would have
otherwise done manually, then my code calls the "exit" routine upon
completion automatically.  I notice that the app disappears from the taskbar
but the process remains in task manager and each time I launch it from a
Shell command, a new process pops up and remains after exiting.

I believe the issue somehow revolves around the exit routine.  The final
command being "unload me".  I modified the code to not automatically exit if
called up from the shell command.  When I close it manually, the process
disappears from task manager.  The exit routine is behind a button, recordset
handles are closed then the unload me is called.  When run from the shell my
code calls this same button_click function automatically but the process
doesn't disappear in task manager.



Mon, 06 Dec 2010 03:27:02 GMT  
 Shell launch / Process End


Quote:
> Hi,
>   I have a simple VB 6 app that I run two ways.  One, I launch it
> directly,
> do what I need, then Exit.  The process appears in Task Manager, then
> disappears upon exiting.  The second way I launch the app is through a
> Shell
> command with command line arguments from another app.  My app looks for
> command line arguments on callup and does the same thing I would have
> otherwise done manually, then my code calls the "exit" routine upon
> completion automatically.  I notice that the app disappears from the
> taskbar
> but the process remains in task manager and each time I launch it from a
> Shell command, a new process pops up and remains after exiting.

> I believe the issue somehow revolves around the exit routine.  The final
> command being "unload me".  I modified the code to not automatically exit
> if
> called up from the shell command.  When I close it manually, the process
> disappears from task manager.  The exit routine is behind a button,
> recordset
> handles are closed then the unload me is called.  When run from the shell
> my
> code calls this same button_click function automatically but the process
> doesn't disappear in task manager.

Something is preventing your app from closing properly. IOW, some remnant of
it, perhaps a form, is still loaded in memory. Best thing you can do is put
a breakpoint somewhere near where your program ends....perhaps the first
line of code in your main form's Unload event.  Open the Project Properties
window.  Click on the Make tab. In the "Command Line Arguments" textbox,
type in the exact command line arguments that would be passed to your
compiled EXE. This will allow you to debug the scenario within the IDE.

Basically, ALL your cleanup code should go in either the Unload or
QueryUnload events.  In your button (that's click to manually close the
program), you should be doing NOTHING but unloading the form. IOW, don't
close recordsets (as you state your doing in the button's code).  Do this in
the Unload or QueryUnload event.

Without more details about your app, it's hard to provide specifics.  But,
what I've described above to debug this should be sufficient for you to
figure out the problem.

--
Mike
Microsoft MVP Visual Basic



Mon, 06 Dec 2010 06:59:28 GMT  
 Shell launch / Process End
Thanks Mike, I'll give that a shot and I appreciate the recommendation on the
programming convention as well.  If time and money were no concern, I'd take
some refresher programming courses, I'll have to at some point.
Quote:



> > Hi,
> >   I have a simple VB 6 app that I run two ways.  One, I launch it
> > directly,
> > do what I need, then Exit.  The process appears in Task Manager, then
> > disappears upon exiting.  The second way I launch the app is through a
> > Shell
> > command with command line arguments from another app.  My app looks for
> > command line arguments on callup and does the same thing I would have
> > otherwise done manually, then my code calls the "exit" routine upon
> > completion automatically.  I notice that the app disappears from the
> > taskbar
> > but the process remains in task manager and each time I launch it from a
> > Shell command, a new process pops up and remains after exiting.

> > I believe the issue somehow revolves around the exit routine.  The final
> > command being "unload me".  I modified the code to not automatically exit
> > if
> > called up from the shell command.  When I close it manually, the process
> > disappears from task manager.  The exit routine is behind a button,
> > recordset
> > handles are closed then the unload me is called.  When run from the shell
> > my
> > code calls this same button_click function automatically but the process
> > doesn't disappear in task manager.

> Something is preventing your app from closing properly. IOW, some remnant of
> it, perhaps a form, is still loaded in memory. Best thing you can do is put
> a breakpoint somewhere near where your program ends....perhaps the first
> line of code in your main form's Unload event.  Open the Project Properties
> window.  Click on the Make tab. In the "Command Line Arguments" textbox,
> type in the exact command line arguments that would be passed to your
> compiled EXE. This will allow you to debug the scenario within the IDE.

> Basically, ALL your cleanup code should go in either the Unload or
> QueryUnload events.  In your button (that's click to manually close the
> program), you should be doing NOTHING but unloading the form. IOW, don't
> close recordsets (as you state your doing in the button's code).  Do this in
> the Unload or QueryUnload event.

> Without more details about your app, it's hard to provide specifics.  But,
> what I've described above to debug this should be sufficient for you to
> figure out the problem.

> --
> Mike
> Microsoft MVP Visual Basic



Mon, 06 Dec 2010 21:30:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Why wait the end of a Shell process ?

2. How to determe when a SHELLed process ends.

3. Check if a Shell Process Ends

4. End a shell process ???

5. How a 32-Bit App Can Determine When a Shelled Process Ends, Article ID: Q129796

6. Help with Determining Shell Process Ends

7. How a 32-Bit App Can Determine When a Shelled Process Ends

8. Determine When shelled process end

9. Determining when a shelled process ends

10. Shelled Process does not end

11. How a 32-Bit APP can Determine When a Shelled Process Ends - Q129796

12. Help: Wait for shelled process to end

 

 
Powered by phpBB® Forum Software