Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 8th, 2002, 01:01 AM
wfs's Avatar
wfs wfs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Sweden
Posts: 29 wfs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to exit a program

I know it's kind of lame and such, but i still don't know, so i'm asking.
What's the function to call when i want to quit my program?
That is, which function should i connect to my "Quit" button in my program?
I tried exit() and quit() but none of em worked, please help, i can't seem to find any help on this online either.
Comments on this post
JimmyGosling agrees!

Reply With Quote
  #2  
Old November 8th, 2002, 01:48 PM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 693 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 4 h 5 m 20 sec
Reputation Power: 25
unload the form, and then end

unload me
end

Reply With Quote
  #3  
Old November 8th, 2002, 04:23 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed God (5000 - 5499 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 5,163 Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 6 Days 1 h 34 m 20 sec
Reputation Power: 791
Be sure to unload all loaded forms before you call end.

VB doesn't have the best memory management and calling end doesn't always clean the memory properly if there are still loaded forms present.

Reply With Quote
  #4  
Old November 10th, 2002, 07:43 PM
GNUbie's Avatar
GNUbie GNUbie is offline
Throws Rocks
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Cincinnati, Ohio
Posts: 392 GNUbie User rank is Corporal (100 - 500 Reputation Level)GNUbie User rank is Corporal (100 - 500 Reputation Level)GNUbie User rank is Corporal (100 - 500 Reputation Level)GNUbie User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 31 m 7 sec
Reputation Power: 13
Fully

Remember you need to put an End command in the Form_Unload event as well. This is key.
__________________
Two things have come out of Berkeley, Unix and LSD.
It is uncertain which caused the other.

Last edited by GNUbie : November 10th, 2002 at 07:46 PM.

Reply With Quote
  #5  
Old November 21st, 2002, 09:06 PM
mcchin mcchin is offline
Mc-Chin
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 86 mcchin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 21 m 50 sec
Reputation Power: 12
Hi All,

Hope someone can provide more info on closing VB apps.

I have an application with dozens of forms and child forms, and using over 20 OCXs...once compiled the exe is around 10 MBs..

under development environment i can "End" the application properly....but when compiled and execute it, when i end the application, all the forms are gone, but under the "Task Management" utility in win2000 (CTRL + ALT + DEL) i can still see my app is running.


in my MDI parent form_unlod, i use
PHP Code:
for each obj in forms
         Unload obj
    next

    end 


but after some reading and etc... i used

PHP Code:
Public Declare Function FindWindow Lib "user32" Alias _
      
"FindWindowA" (ByVal lpClassName As StringByVal _
      lpWindowName 
As String) As Long
Declare Function PostMessageByNumLib "user32" Alias _
    
"PostMessageA" (ByVal hwnd As LongByVal wMsg As _
    Long
ByVal wParam As LonglParam As Long)

Const 
WM_CLOSE = &H10
Const TARGET_CLASS_NAME "ThunderRT6Main"
Const TARGET_WINDOW_TEXT "Project1"

....Form Unload event (MDI parent)....
    for 
each obj in forms
         Unload obj
    next


    hTarget 
FindWindow(TARGET_CLASS_NAME TARGET_WINDOW_TEXT)
    
' The following line will close the app.
    ' 
You could instead set up a subclasser here.
    
    If 
hTarget Then Call PostMessageByNum(hTargetWM_CLOSE00)

    
end 



with the above, i can end the VB App.

any comments?

Thanks and Best Regards
Comments on this post
JimmyGosling agrees!
__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How to exit a program

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap