Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / January 2005



Tip: Looking for answers? Try searching our database.

VB6 Application closure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barbara - 24 Jan 2005 23:26 GMT
How do You close UserDocument.vbd from VB6 code?
How do you close an application from VB6?

Once I exit my application, the window with
UserDocument.dob file stays open.  As I close my
application I want this window to be closed too.   How do
I do that.  

Thanx
Veign - 25 Jan 2005 00:40 GMT
> How do You close UserDocument.vbd from VB6 code?
From what I read IE creates a hidden reference to your ActiveX Document and
holds the reference for approx. 10min regardless of the number of documents
that have been viewed since.  Closing IE will release the reference and the
documents terminate event will fire...

> How do you close an application from VB6?
Unload all forms and release all objects

Just curious how and why are you using ActiveX Documents?

Signature

Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--

> How do You close UserDocument.vbd from VB6 code?
> How do you close an application from VB6?
[quoted text clipped - 5 lines]
>
> Thanx
Barbara - 25 Jan 2005 16:07 GMT
This is an old program that was written few years ago,
and that is how someone designed it. Is there one command
to unload all the forms at once and release all the
objects at once?
If yes, can I get a sample.

Once again, Thanx.

>-----Original Message-----
>> How do You close UserDocument.vbd from VB6 code?
[quoted text clipped - 19 lines]
>
>.
Ken Halter - 25 Jan 2005 16:45 GMT
> This is an old program that was written few years ago,
> and that is how someone designed it. Is there one command
> to unload all the forms at once and release all the
> objects at once?
> If yes, can I get a sample.

There's no such command.

For the forms, you can do something like....

Dim f as Form
For Each f in Forms
  Unload f
Next

for the objects, you're on your own. Just keep track of any you create and
make sure they're gone (their reference is released) when you attempt to
shut down.

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Veign - 25 Jan 2005 17:06 GMT
Beat me by a mile...A.D.D kicked in and got stuck doing something else
before completing the post<g>

Signature

Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--

> > This is an old program that was written few years ago,
> > and that is how someone designed it. Is there one command
[quoted text clipped - 14 lines]
> make sure they're gone (their reference is released) when you attempt to
> shut down.
Ken Halter - 25 Jan 2005 17:50 GMT
> Beat me by a mile...A.D.D kicked in and got stuck doing something else
> before completing the post<g>

hmmm.. ADD's always kicked in here <g> How to "un-kick" it? I dunno...
wait... I'm getting side tracked here... what were we talking about? <g>

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Compu-Pikachu - 29 Jan 2005 05:24 GMT
[VEIGN] ADD kicked in and got stuck doing something else before completing
the post.  <g>

[HOSHI PATRICIA FRIEDMAN] You have ADD?  Someone on alt.hypnosis does, too,
as does Compu-Pikachu's brother.
Karl E. Peterson - 31 Jan 2005 20:39 GMT
> [HOSHI PATRICIA FRIEDMAN] You have ADD?  Someone on alt.hypnosis
> does, too,

No way!
Signature

[Microsoft Basic: 1976-2001, RIP]

Veign - 25 Jan 2005 17:04 GMT
Forms you can use:

Dim MyForm As Form
For Each MyForm In Forms
   Unload MyForm
   Set MyForm = Nothing
Next

Objects:
You have to cleanup after yourself.  Most of the time the objects will be
released when the variable holding them goes out of scope.   Problem with
that is certain objects require more hand holding (like closing a DB
connection)...

Signature

Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--

> This is an old program that was written few years ago,
> and that is how someone designed it. Is there one command
[quoted text clipped - 33 lines]
> >
> >.
Barbara - 25 Jan 2005 18:09 GMT
So
Does it mean that once all the forms are unloaded, and
all the objects released this should close automatically?
I have UserDocument_Terminate function which only has END
command in it, and if everything is cleaned properly, it
should go to terminate and close itself? Wright?

Thanx
Barbara

>-----Original Message-----
>Forms you can use:
[quoted text clipped - 50 lines]
>
>.
Ken Halter - 25 Jan 2005 18:42 GMT
> So
> Does it mean that once all the forms are unloaded, and
[quoted text clipped - 5 lines]
> Thanx
> Barbara

There's no reason to use End... in fact, get rid of it because it may be
causing you problems. Think of End stopping your program being equal to
turning of a TV by yanking its plug out of the wall (I'd say "record
player", but, these days, people would say "what's a record?" or "what's a
record player?" <g>)

To answer the initial question though, Yes.... a VB program "dies" on its
own when all objects are released, all forms are unloaded and it runs the
final 'End Sub' in your app.

A quick demo of that needs a new EXE project with a single command button.
'===========
Option Explicit

Private Sub Command1_Click()
  Unload Me 'place a breakpoint here and use F8 to single step.
End Sub 'Program dies after running this line
'===========

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Barbara - 25 Jan 2005 20:58 GMT
Sorry to bug you so much, but I really want ot understand
what is going on.
When my program ends, what I am left with is is an empty
UserDocument.vbd open in Microsoft Internet Explorer (the
pick that was displayed is no longer there). So this
Microsoft Internet Explorer window is part of the VB
application?

When I look under Windows Task Manager everything is
closed except IE, and that is what confuses me.

>-----Original Message-----
>> So
[quoted text clipped - 25 lines]
>End Sub 'Program dies after running this line
>'===========
ceryboy - 25 Jan 2005 17:41 GMT
I know that you use the internet to runyour userdocument you just navigate
to another page or go back to home page. That's how I understand it. I'm new
to this forum but I wrote also userdocument and it running now at my website
. trying to improve it.

> How do You close UserDocument.vbd from VB6 code?
> How do you close an application from VB6?
[quoted text clipped - 5 lines]
>
> Thanx
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.