
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