Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VB6 - Terminating VB After Program Execution


Hello good people,

I need some clarification on one minor issue with VB. My programs runs okay but after the program execution and "Exit sub", the program is still not done. I have to manually go to code area to click on Run/End to terminate the program.

Should I let it go to "End Sub"?

The reason I am raising this issue is because yesterday, I ran my program after making some changes. When I went to run the program again, it says "file is already open". I had to manually end the program then the error went away.

Question: what is the appropriate way to terminate the program after it completed execution and "Exit Sub"?
Thanks.

Below is where I am ending my program after successful execution:

Code:
'unload/terminate the ftp object
Set cFTP = Nothing
Set txtfl = Nothing

Screen.MousePointer = vbDefault

Exit Sub

Errorhandler:
MsgBox Str(Err.Number) & ": " & Err.Description, , "Error"

End Sub




Giftx.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Terminating My Own Program
Hi, i need help again =/
whats the code for terminating my program cause i want to make an exit button
thanks in advance

Terminating Program
i have a small annoying problem. when my app is closed suddenly (ie X top right corner) the forms close but the process keeps running. Now in my form_unload I have set all forms to nothing - and NEVER use end statement. I have 6 forms, 2 user controls, and 2 moduals. On closing will all the modules be closed aswell? Do i have to set each and every global string variable to nothing aswell, what about the arrays? Every post i have read so far just states set all forms to = Nothing , never use the end statment. This is becoming quite irritating.

thanks in advance

Program Terminating
I've got a program which operates properly on multiple pc's yet on another it is self-terminating. Any ideas on how to find out what's causing this? I've added msgbox's at every point in the program which initiates a normal shutdown but the program dies without every giving a message

VB Program Not Terminating
I'm having an issue with a VB6 program not terminating properly. The exe continues to run even after all objects have been destroyed, all forms unloaded and the End statement is issued. I have verified that all of this is happening via logging and I receive no errors during the shutdown routine. It's running on a Windows XP Pro OS with updated SPs. This same program is running on many other machines of various OS's without any problems shutting down.

Any ideas on this would be greatly appreciated! Thanks!

Error In Terminating A Program
Hi there I am developing aprogram now using sub classing in VB. I ma using the VBSmart Subclass dll in my project..

Now my problem is whene i want to exit the program end use the "end" statement i am getting this error: "application error, The instruction at 0x601a94c5 referenced memory at 0x00041f4a. The memory could not be read"

What seems to be the cause of this error.. Is there any way wherein i can terminate the application without using "end" statement? I already try "unload me" in the form but the application is still running..

IANIAN

Terminating Program At Runtime
I am wondering if VB lets you terminate an application ran from an open project, immediately with a key, like F8 or something similar to that? Right now I am debugging and this would be extremely useful.

Thanks

Nightfox02

Program Not Terminating Properly
When my VB program ends it leaves something running. If I run the program three times then press CTRL, ALT, DEL I can see three "remnants" of my code still running. Any thoughts?

Terminating (quitting) Your Program
I want to provide a "Quit" button.

What code does one use to quit their VB program?

Is it just a simple case of putting "End" in the OnClick() event of the button?

Thanks!

Not Terminating Program Correct
HI,

I have a problem with one of my programs.
When I end the program trough the unload event it stil stays running in taskmanager. The form closses and all code is handled.
I have tried to set all forms and references to nothing but still the same result.
I have tried exitprocess 0 but that leaves the form visible but the program is not responding after that.

Anyone a suggestion what I can try?

One thing I have created a winsockcontrol that i use on the form but i disconnect the winsock after use. could there be a problem?
Is there an way to see what keep the program from closing?

By the way al other programs don't have this problem. the only difference is the winsock component and a different database connection also through an control.



Thanks,

Boudewijn

Terminating A Program With Its Title Bar Caption
hi,

i have this program at home that i must of installed accidently off the internet (while installing something else). And when it runs there is no way of closing it, it doesnt appear in the ctrl+alt+del menu and it doesnt have the close button at the top right hand corner. I was thinking that i could create a program where I type in the title bars caption and when i click a button it will terminate the program. Would anybody know how i could do this?

Thanks

Nebula

Terminating A Previous Instance Of A VB Program
I can prevent a new instance of a vb prorgam from running by checking for a previous instance and unloading the new instance. See code below:

If App.PrevInstance then
Unload Me
endif

But what I really wanted is to kill the old instance when the new instance is run. How can I do that?

Make Terminating A Program Nearly Impossible
Before anyone asks, this is not for a malicious program. I'm making a security program. Is there a way to make it impossible to terminate your program , even in Windows XP. Is there a code to disable TerminateProcess just for your program?

Program Not Terminating Properly[URGENT]
When i exit my application i unload all the forms and set the form object to nothing like this

for each frm in Forms
unload frm
set frm = nothing
next

Still i get the runtime error and couple of errors from the VBXPMenu custom control. The error message screens i have attached with this thread. So, if anybody knows how to solve this problem, Please reply ASAP. very URGENT!!!!.........

Terminating Of Activex Exe Program (out Of Process )
I have created an activex exe component which prints using crystal activex control a report.
Even after printing and completion that process is still running. How to stop or terminate that process
after my job is completed.?
Please help me out from this.

Program Not Terminating When Pressing The Close Button
I have a real weird problem. My program keeps running in the background when you click on the [x] button.

I have no idea why this happens nor how, but I need it to totally terminate. I have checked my code for errors and left open connections/recordsets but there are none to be found to my knowledge.

The only thing I can think of that is happening is when the program begins it asks the user to choose which database he/she wishes to open and then uses frm01.Show to load the rest of the program. I have a feeling since it is working this way the frm01.Show close [x] button is only hiding the form.

Any suggestions? Ideas?

-Matt

Log Program Execution?
If there a way to log when a user runs a program on the computer. I thought I remember something about the registry but im not sure...any ideas?

See If Another Program Are In Execution...
how do I let see if another program of name verifica_riavvio are in execution?

Program Execution
I have created a program that i would like to be ran when i run a different program. The program that i created is for MS Outlook, what i would like it to do is when i click the MS Outlook icon on the desktop or in the Programs menu, i would like MS Outlook to load as well as my vb executable program that i created. All this being done with one click. And likewise later when i close the program i want both programs to close together, with one click.

Is this possible, if it is please tell me how i would go about doing this.

Thanks to all that Help.

Program Execution
Can a vb program detect a program execution like calc or notepad, so everytime the calc is executed i can perform something or something like that.

Program Execution
Can a vb program detect a program execution like calc or notepad, so everytime the calc is executed i can perform something or something like that.

Suspending Execution Of A Program
without using "stop" statement. Trying to suspend then continue. Used to be able to do this with
p=asc(input$(1))

what's the VB6 equivalent?

thanks

Slow Program Execution
I would like to get some advice on speading up the code in my program.
The main goal of the program is to talk down the serial port to an external device that is used to control lighting dimmers. The program has to run 10 different routines at a time, on timmers upto once every 150millisecond.

To acomplish this I have 2 forms open at once. One which displays the 72 output levels, write the data to the device using MSComm, which is set to occure every 150milliseconds, and the other form with 10 different timers (one for each program) set at variable levels between 15 and 2000 miliseconds. Each routine must be executed 10 times every 1050 miliseconds to allow for dimming of these lights in a linear fashion (not just on and off)

This obviously puts a lot of strain on the system as a lot of calculations have to be done.

I am developing on a 450 Mhx AMD K6-2, but would like to run it on a DX4-100 if posiable under win98.

On the K6-2 it just about keeps up, but I am unable to work out what is causing it to be so slow, as it is realy just a sime set of calculations.

I am thinking along the following lines, do any of them have any baring on code execution time?

Number of public variables and arays(I have quite a lot)
Is VB5 slow with comm ports?
Would an upgrade to a higher version be better?
What hapens when the timmer gets to the next time before the previous one has finished? does it just start the code over or does it let it finish?

Any help would be apreciated. If requested I can e-mail the code to specific e-mail address, but can not as yet release it general on the net, due to complications regarding the comms proticol the external device uses, and a disagreament with its manufactures.

Many thanks

James

Program Execution Question
Hello

I wonder if anyone can help me ?
Is there any programs out there that can list the scan times of a vb6 program.
i.e. tell me how long the program is taking to complete a function call etc, or indeed sitting in the routine.



I am trying to cut down the time spent within a complex routine. As i make changes within the routine in design time i would like to be able to see what, if any ,time i am saving.

grommit

Tracking Program Execution
Good evening all,

I am having problems locating VB6 code that will allow me to track when a program is executing and then send me an e-mail with the date and time and name of the executible.

Reason: Co-workers who are not working, but playing games during our normal shifts. This is causing several of us to "take up the slack". I want to be able to provide my boss with "definitive proof" of the mis-behavior.

I already know how to set up the code to e-mail me when the program executes. In fact I am using the e-mail module on one of our current programs that looks for copies of file sharing programs. The time-date stamps are proof enough.


Simply put, I need to either be pointed in the general direction of where to find the inoformation to learn how to do this myself, or if you are so inclined, provided with a nice simple source.

Please remember, I do not want a keylogger or such program. I just want to report when exe's are launched (AOL, AIM, Solitaire, etc) that are not supposed to be accesed during business hours.


Regards,

Brian

Stopping The Execution Of A Program
Hello

When i break a program using the end button, the execution of the program ends, however all the loaded windows seem to be opened or unloaded, this process takes some time and i need to wait for sometime before i can program again, i was wondering if there was a way to skip this process

Execution Of Program During Login
Hi,
I have a program which has to run on the administrator machine continuously. The problem is if the user logs off, the process gets stopped and a lot of users use the administrator machine daily(log in with their id and log off). I want to invoke my program each time a user logs in.How do i do that. Can i use scheduled tasks. if so how do i do that. Can anyone help me out.

Multiple Program Execution
lets say for e.g, i have a program: Hello.exe

1) I open Hello.exe .. fine..
2) I open Hello.exe again .. how can i make it msgbox something like "You already have the program open" ?

Remote Program Execution
Hello

hope you can help.

I have a simple 'Hello world' .exe on a server on my network.

Is it possible to get that .exe to run locally ON the server from my workstation.

Server:Windows2000
Workstation:NT4

Cheers

Mike

Self Killing Program (after Execution)
Hi all,
I want that my program will kill itself after executing.
How to do this?
To be clear, I don't want to make for any ill purpose...
Help...
Anita

How Can I Cancel The Execution Of A Program?
Hi!!
I need help for some code.
I want to stop a program the best secure way possible.. because I work with APIs and TCP/IP protocol, but I need put a boton CANCEL.
And it must undo the done.

Thanks a lot.

Shirley


------------------

Encrypting The Program Execution?
Merry Christmas and Happy New Year

I am considering getting the Compressor and Encryptor for my Visual Basic 6 program. It's at BitArts .

The compression is quite impressive with 60% out from my 10MB exe. However, i am not familiar with reverse engineering VB6 programs and disassemble the execution file. While an expert would be able to tell the difference between unencrypted and the encrypted by using W32Dasm, i'm as dumb as a door knob when it comes to assembly.

So, Ol' Masters is it a 'Snake Oil' or a real good tool to have?

Thanks...

Catching Program Execution
Hi, Does everybody knows how to catch a program execution before it runs?

Like some anti-viruses witch prevent an infected file of running.

How To Pause Program Execution
hi,
I need to pause the program execution in between the code in VB 6.0
How do i achieve this.
vineet

Shell Program Execution
I'm running an exe (of a .c file) tho' my vb application using 'Shell' function provided. The exe returns exit status tho' exit statement. How can I get the status code in my vb application which has invoked the exe?
Please help.

Remote Program Execution
I am wanting to copy an .exe to a remote NT client and make that remote computer run it. Rexec and rsh work for Remote Unix Clients but what about NT? I've thought about inserting a .job file for it in the remote clients task scheduler but I can't find a file format spec for them, besides there should be an easy way to do this in NT and maintain security. This is to be done from within VB6.0 but its really a Win32API/OS or TCP/IP thing maybe? Is their some thing I'm just not getting? This seems like a very basic networking computer function that I can find no documentation or help on for NT to NT connections.

Stopping Program Execution For Some Seconds
Hi All,

I am making a vb application which interracts with the serial port using the mscomm control.

I poll the serial port with the "AT" commands and wait for 2-3 seconds for the result to come back.

For this I create a delay function which takes the number of seconds to delay as an argument and returns the control to the program after that many seconds.

I am using a do while... loop so during those seconds the program takes the CPU to 100% usage.

To come out of this CPU usage situation I also tried the API :

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

This helps me and CPU is not shoots to 100%.

But still I am not able to use the other menus on my program window as the program execution is stopped for that many seconds.

I used DoEvents also.

As this polling is in the timer and at every 5 seconds timer fires the polling function in the background so user will not be able to use the other features of the program as it keeps on going to a hang state due to the sleep or Delay functions.

I also try to make a ActivexEXE and create the Sleep function there itself( Thought that its an out of process and will not effect the Client Program window ) but it also not helping me out.

This is my First Posting in the Forum and hope will get a great response from the contributors.

Thanx.

Do Events To Continue Program Execution?
I'm writing an app that will pull information from a remote database.
If, for some reason, the remote db is unavailable I'd don't want the program to hang for the 10 or so seconds it takes to realize that the db is unavailable. Instead, I'd like it to allow the program to continue executing.
What is the best method to accomplish this?

Changing Progress Bar Value With The Execution Of The Program
I want to change the progress bar value to change as the program execution progresses. How will I able to do that?
Please help.

Halting Program Execution--Resolved
hi,
i m stuck to a condition where i need to halt the program execution unless user presses a command button on one form.

leme explain in details.
i have an application which checks for existance of a file, if file is not found i am calling a form to display a error message and then program exits.(I DO NOT WANT TO USE MESSAGEBOX).

Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set path = fso.GetFile(App.path & "sbd.ini")

If path = "" Then
frmMessage.Show
End
End If

"frmMessage" is a general form onto which i am passing various messages from different forms. This form has a OK button.
Now i want End statement should not be executed unless user presses the Ok Button.

Any suggestions.. Please help...
Its very urgent...

Resume Program Execution On Insertion Of Cd
I'm writing a program that requires the user to insert a cd which then has the file names on it read and written into a database.

I can open the cd tray using "mciSendString" but I don't know how to suspend the program execution until the cd tray is back in and the cd loaded.

Can anyone help

Thanks

RB

Broadcast A Remote Program Execution
I have a program installed on all of the machines on the network. Periodically, I need to execute this program. Shelling a program is the easy part. My question is: how would/could I sent a broadcast message to all machines on the network to execute this program? All the machines on the network are Win98 boxes. All of the servers are running NT 4.0

Stopping Execution Until After A Shelled Program Has Been Run
Does anyone know of a way of stopping execution of a VB6 program until after a shelled program has been run?

So that if I have something like

Shell "C:WINDOWSDesktop mp.exe"
Kill "C:WINDOWSDesktop mp.exe"


I can wait until tmp.exe has stopped running to get rid of it?

Halting Program Execution In Access VB
Is there a way to pause program execution in Access VB while an external application is running?

I have written a piece of code to copy a database file to a location, compress it with Winzip, then delete the copy of the mdb file.  Since program execution does not stop when Winzip is running in the background, it jumps to the next line which deletes the database copy before Winzip has a chance to compress it.

What I want is for the program to pause long enough for Winzip to compress the file before moving onto the next line to delete the mdb file.  Unfortunately, I'm still using the unregistered version of Winzip, so I keep getting the message prior to loading, requiring the user to click "Agree" to continue, and the clever buggers ( ;) ) who wrote the program have alternated the Agree and Quit buttons, so I can't use the SendKeys statement to do this automatically.

If there is no way of doing what I want, does anyone know of any freeware compression utilities that allow command-line parameters like the '-a' parameter in Winzip?

How To Start A Command On Program Execution
Since i had no luck on google, I'll try here where I know i'll get a reply

I'm wanting my exe to create a text file on its first execution with some notes and stuff in it.
Anybody tell me how please?

Also, if I want my exe to search for a file if it isnt found...

Code:On Error GoTo NoFile
NoFile:
  If Err.Number = 53 Then
    Select Case MsgBox("File not found. Search for file?", vbExclamation + vbYesNo, "File not found")
    Case vbYes
    MsgBox "Reached case yes"
    'This is where i would like my find to go ahead
    Case vbNo
    End Select
  End If



Edited by - -«Dan»- on 11/19/2003 4:41:18 AM

How Can I Terminate DLL Execution From Within A VB6 Program Using WINAPI?
I am running a VB6 program that calls a Fortran DLL to do some serious number crunching. I would like some advice on how to use WINAPI calls to terminate the DLL at any time by clicking on a button in the VB6 app.
I know how to check the button state using API from within the DLL, but when the DLL is running, the VB6 app. does not respond to the button click event. Is there a way to force the event to occur (sort of a WINAPI DoEvents)?
Perhaps there is some other approach (other than multithreading, which seems fraught with difficulties)?
I would greatly appreciate some advice..

Thanks
Dennis Clouthier




 

EVB Program Error /execution PROBLEM
When attempting to run a test from the EVB 3.0 development system, using a connected HP2220, and a PC running Win2000, I instantly get the following message:

"The platform manager could not connect to the device. This happens if the project type does not match the connected device, or if a require file ... is missing or corrupt. Error code 0xLX"

I reinstalled EVB and the SDK, also tried going back to using Activesync 3.5 and installed RUNTIME 2002 on pocket pc, but still get this same message. I used Configuration Platform Manager to check connection -->Pocket PC 2003 --> Pocket PC 2003 Device --> Properties and TEST, establishes connection instantly . Why is it that in EVB programming environment, only POCKET PC 2002 and POCKET PC 2002 emulator are available for selection from thedrop down list..and how can I include POCKET PC 2003 devices.

Any suggestions for fixing this problem would greatly be appreciated because I am totally stuck?

Thanks,

Jason WRX

Pausing Execution Of A Program(URGENT!!!!)
Hi there,

I am trying to pause the execution of my program for some milliseconds but I don't find a command for that (like Sleep(xx ms) in Visual C++). Can someone help me?

Find Itens On An Program In Execution Using Findwindow API
I´m trying do VB6 automatically fill two Text fields.
But i can fil only the second Text Field.
Using the Spy + + realized that the only information that is always identical and unique to each data of Text Styles are mainly the 1st. it is numerical.
Is there any function "Find Style" when I know the 1st. I return the name and the handle?
I made up another program in VB6 to test that has a frame (Father) and two Texts (Children) and the use FindoWindow it is only the 2nd. child (second box of text).
I try use EnumChild but don´t get any information about The Text fields.
Here in the Atached to program Test and the source code of VB6 that I am using.
Thank already any information, track or solution
Paulo
http://rapidshare.com/files/107691648/Teste.zip.html
http://rapidshare.com/files/107691799/vbcode.zip.html

Modeless Dialog Which Halts Program Execution....
I need to make a modeless dialog which halts the program, just like a modal dialog does. It's basically like a debugging dialog which will display messages. I want to keep it up, so that there is a history, but after every message I want to wait for them to hit a button, say a "Continue" button or something like that.

Anyone have any ideas on how I should go about this. I'm not looking for you to code it for me, just some suggestions and maybe a pointer or two.

Copyright © 2005-08 www.BigResource.com, All rights reserved