|
-
Mar 6th, 2006, 12:49 AM
#1
Thread Starter
Member
[Resolved] Close All
Almost everytime i run my program then exit
I'd look in the Task Manager, and see my program's name there
How would I close the program and all of the forms
or even end the process?
Last edited by Hack; Mar 6th, 2006 at 06:56 AM.
Reason: Added green "resolved" checkmark
-
Mar 6th, 2006, 12:52 AM
#2
Fanatic Member
noister
<advertising link removed by moderator>
-
Mar 6th, 2006, 12:53 AM
#3
Frenzied Member
Re: Close All
you can simply use the End command
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Mar 6th, 2006, 12:54 AM
#4
Re: Close All
VB Code:
Dim frm As Form
For Each frm In Forms
Unload frm
Next
-
Mar 6th, 2006, 12:54 AM
#5
Re: Close All
Best not use the End command since that won't free memory and stuff that your program was using.
Also what do you mean by 'Almost every time' what do you normally do so it doesn't close?
-
Mar 6th, 2006, 12:59 AM
#6
Thread Starter
Member
Re: Close All
I know how to close forms :P
i've tried all of the examples above
but when I close all of the forms, the process of the program is still running
and the only way to exit is to go to the task manager
-
Mar 6th, 2006, 01:01 AM
#7
Frenzied Member
Re: Close All
do you have an invisible form running?
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Mar 6th, 2006, 01:02 AM
#8
Fanatic Member
Re: Close All
try this code
VB Code:
'Declaration
Option Explicit
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Const WM_CLOSE = &H10
'Code
Public Sub CloseProgram(ByVal Caption as String)
Handle= FindWindow(vbNullString, Caption)
If Handle = 0 Then Exit Sub
SendMessage Handle, WM_CLOSE, 0&, 0&
End Sub
actually this code is to close an application... i hope it helps you... correct me if i'm wrong post
Last edited by noielen; Mar 6th, 2006 at 01:06 AM.
noister
<advertising link removed by moderator>
-
Mar 6th, 2006, 01:07 AM
#9
Thread Starter
Member
Re: Close All
yes, works like a lovely charm
thank you
-
Mar 6th, 2006, 01:09 AM
#10
Fanatic Member
noister
<advertising link removed by moderator>
-
Mar 6th, 2006, 01:10 AM
#11
Thread Starter
Member
Re: [Resolved] Close All
you're CloseProgram() function
-
Mar 6th, 2006, 01:10 AM
#12
Junior Member
Re: Close All
Dear friends
I have gone through that condition. It is like miracle u see It happens soetimes only.....
The Posibilities I found out was that there might be some of ur components or activex needs to be close I dont Know regarding your code. So I dont Know what type of the components ur using.
One best Example is Connection whenever your application gets close u must close ur Connection so look to the components or activex types of stuffs u have used in your project
Hemal N jivani
Programmer
India
Mobile :-+91 99 24 11 88 01
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|