[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Win Op After UnLoad & Delete Self

BeeJ

2/21/2012 8:43:00 PM

I would like to perform a windows operation using a windows method
after my VB6 app closes. The VB6 app would, as the last thing before
unloading, start the windows "method". e.g. create then initiate a .cmd
that has a delay at the start or some other way.
It would be best it the Windows method would clean itself up i.e.
delete itself but that is not mandatory.
I want to use something that is part of windows to do this like the
..cmd. I know the .cmd will stick around but I could delete it the next
time the VB6 app starts.
Also there is I believe Windows scripting and tasks but I am not
familiar with these and the terminology.

(1) What ways are there to do this?

(2) Additionally, is there a way for the VB6.exe to delete itself?
I know how to delete a file on reboot but I would rather delete
immediately.


9 Answers

ralph

2/21/2012 9:53:00 PM

0

On Tue, 21 Feb 2012 12:42:54 -0800, BeeJ <nospam@spamnot.com> wrote:

>I would like to perform a windows operation using a windows method
>after my VB6 app closes. The VB6 app would, as the last thing before
>unloading, start the windows "method". e.g. create then initiate a .cmd
>that has a delay at the start or some other way.
>It would be best it the Windows method would clean itself up i.e.
>delete itself but that is not mandatory.
>I want to use something that is part of windows to do this like the
>.cmd. I know the .cmd will stick around but I could delete it the next
>time the VB6 app starts.
>Also there is I believe Windows scripting and tasks but I am not
>familiar with these and the terminology.
>
>(1) What ways are there to do this?
>

Just Shell another Application is probably the easiest way.
You could put some kind of delay or wait in it. Perhaps checking for a
mutex, file, ....

Look forward to some of the interesting methods others will soon come
up with.

>(2) Additionally, is there a way for the VB6.exe to delete itself?
>I know how to delete a file on reboot but I would rather delete
>immediately.
>

[By "vb6.exe" I hope you meant a VB6 created application and not VB6
itself? <g>]

yeah it can be done by some kind of 3rd party "controller" application
- either a process that launched the exe, or an application that is
later spawned. (See above)

Installers do this all the time - through a separate install
application. But attempting to have one application delete another
will, and hopefully will, set off anti-virus alarms or at least annoy
Windows to some degree. <g>

-ralph

James Tyler

2/21/2012 10:18:00 PM

0

you can rename an exe while it is running. Maybe this oddity can be useful.


Mike Williams

2/21/2012 10:34:00 PM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:ji0vkb$gti$1@speranza.aioe.org...

> I would like to perform a windows operation using a windows
> method . . . It would be best it the Windows method would
> clean itself up i.e. delete itself . . . Additionally, is there a way
> for the VB6.exe to delete itself? I know how to delete a file
> on reboot but I would rather delete immediately.

You could place code in your main Form's Unload event to trigger a suitable
timing sequence in the otherwise hidden portion of the BIOS so that it
initiates the system's self destruct sequence the next time the user clicks
the mouse after your VB6 program has closed. This would cause the BIOS to
enter into numerous destructive sequences, including playing Barry Manilow
records at high volume through the motherboard speaker, until the entire
motherboard burst into flames. Would that annoy the user enough for your
needs?

Mike



James Tyler

2/21/2012 10:57:00 PM

0

I clicked on some yahoo headline just to see what funny comments people come
up. Now I have to check here also.



"Mike Williams" <Mike@WhiskyAndCoke.com> wrote in message
news:ji163f$b3d$1@dont-email.me...
> "BeeJ" <nospam@spamnot.com> wrote in message
> news:ji0vkb$gti$1@speranza.aioe.org...
>
>> I would like to perform a windows operation using a windows
>> method . . . It would be best it the Windows method would
>> clean itself up i.e. delete itself . . . Additionally, is there a way
>> for the VB6.exe to delete itself? I know how to delete a file
>> on reboot but I would rather delete immediately.
>
> You could place code in your main Form's Unload event to trigger a
> suitable timing sequence in the otherwise hidden portion of the BIOS so
> that it initiates the system's self destruct sequence the next time the
> user clicks the mouse after your VB6 program has closed. This would cause
> the BIOS to enter into numerous destructive sequences, including playing
> Barry Manilow records at high volume through the motherboard speaker,
> until the entire motherboard burst into flames. Would that annoy the user
> enough for your needs?
>
> Mike
>
>
>


Larry Serflaten

2/22/2012 5:52:00 PM

0

On Feb 21, 2:42 pm, BeeJ <nos...@spamnot.com> wrote:
> I would like to perform a windows operation using a windows method
> after my VB6 app closes.  The VB6 app would, as the last thing before
> unloading, start the windows "method". e.g. create then initiate a .cmd
> that has a delay at the start or some other way.
> It would be best it the Windows method would clean itself up i.e.
> delete itself but that is not mandatory.

OK, go ahead. What's stopping you? See Shell in VB help for more
info.


> I want to use something that is part of windows to do this like the
> .cmd.  I know the .cmd will stick around but I could delete it the next
> time the VB6 app starts.

To do what, exactly?

> (1) What ways are there to do this?

To do what? You said your VB app will launch some task, OK, then do
it....
What other ways are you looking for, either it launches the task, or
it doesn't.


> (2) Additionally, is there a way for the VB6.exe to delete itself?

Try this: create a simple 1 form exe from VB, then run that file and
while that exe is running, try to delete it. What does Windows tell
you?


LFS

BeeJ

2/22/2012 11:13:00 PM

0

> You could place code in your main Form's Unload event to trigger a suitable
> timing sequence in the otherwise hidden portion of the BIOS so that it
> initiates the system's self destruct sequence the next time the user clicks
> the mouse after your VB6 program has closed. This would cause the BIOS to
> enter into numerous destructive sequences,

I already know how to do that.

> including playing Barry Manilow
> records at high volume through the motherboard speaker, until the entire
> motherboard burst into flames. Would that annoy the user enough for your
> needs?
>
> Mike

Now I know what to get you for your birthday. Didn't know you were
such a big fan. Barry will be at the Hollywood Bowl July 2. You can
stay at my place while you are here.

And I do not have to do anywhere that much to annoy my users (mostly
myself).


BeeJ

2/22/2012 11:13:00 PM

0

Phil Hunt explained :
> you can rename an exe while it is running. Maybe this oddity can be useful.

Yes, I already know abot that.


BeeJ

2/22/2012 11:16:00 PM

0

Got it all figured out.
My app deletes itself after performing its task.

I think it is quite a useful app so I may release it on Planet Source.


Dee Earley

2/23/2012 11:14:00 AM

0

On 21/02/2012 20:42, BeeJ wrote:
> I would like to perform a windows operation using a windows method after
> my VB6 app closes. The VB6 app would, as the last thing before
> unloading, start the windows "method". e.g. create then initiate a .cmd
> that has a delay at the start or some other way.
> It would be best it the Windows method would clean itself up i.e. delete
> itself but that is not mandatory.
> I want to use something that is part of windows to do this like the
> .cmd. I know the .cmd will stick around but I could delete it the next
> time the VB6 app starts.
> Also there is I believe Windows scripting and tasks but I am not
> familiar with these and the terminology.
>
> (1) What ways are there to do this?

This is normally frowned upon, but using MoveFileEx (with admin
permission) allows the exe to be deleted on the next boot of Windows.

> (2) Additionally, is there a way for the VB6.exe to delete itself?

No, the module is loaded, you'll get an access denied error.

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)