Re: About quit the program
try
unload me
HTH
cksiow
http://vblib.virtualave.net - share our code
Re: About quit the program
It is a misconception that a Visual basic program must have a window.
If you have a .BAS module with a Sub Main you can set this to be the startup procedure and it will run and exiot when it gets to the end e.g.:
public Sub Main()
If Command$() = "" then
MsgBox "Application run with no parameters"
else
MsgBox "Application ran with parameters - " & Command$()
End If
End Sub
After pressing OK on the message box the program will unload completely.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Re: About quit the program
Because this program is basically a background program in server, I really do not want any screen comes up.
I've tried to set form visiable to false, and 'End' or 'Unload Me' in the end of my process. In that way, the form will not appear, and program will end in application.
But when I look at the NT task manager, in the 'Processes' view, it still shows there. Each time I call the program, it will have one more in the 'Processes' view.
I don't know if that's Ok or not, but I think for more than 1000 calls a day, it will be a pain.
If you love it, you get it.
If you don't love it, you never get to it.
Re: About quit the program
I've tried 'Unload Me' same as 'End' in the end of my process. In that way, the form will not appear, and program will end in application.
But when I look at the NT task manager, in the 'Processes' view, it still shows there. Each time I call the program, it will have one more in the 'Processes' view.
I don't know if that's Ok or not, but I think for more than 1000 calls a day, it will be a pain.
Here's part of my code:
private Sub Form_Load()
Dim setMode_result as Integer
Dim send_result as Integer
Dim Ms as string
Dim Ml as Long
' Ms = "0000000103Testing Company 1st name Test comp last name (770)623-0331 (1605) ACTIVESALES 000103SE42000-01-01 END"
' Ml = len(Ms)
' MsgBox Str(Ml) + " ---- " + Ms
'Some API calls
Unload me
' or End
End Sub
If you love it, you get it.
If you don't love it, you never get to it.
Re: About quit the program
As Clearcode says just use a sub main and then you have no need for a form. If your program is not exiting correctly don't use the end statement as this does not close the program correctly and references may be left in memory leading to memory leaks. In fact I would NEVER use the end statement for this reason.
If you use any set statements in your program ten make sure the you use the set to nothing statement as well to insure that memory is released. Close and set to nothing any recordsets,connections you may have to a database as not doing this may cause the program to remain in memory as well leading to the problem you describe.
Re: About quit the program
okay, try this two API
GetCurrentProcess
TerminateProcess
HTH
cksiow
http://vblib.virtualave.net - share our codes
Re: About quit the program
Try this:
Unload me
Set frmName = nothing
ASLU
Re: About quit the program
'Some API calls
'Your matter seems related to those "Sime API calls": one of them may be still running in background; Ie: if you create a timer via Api, you should kill it before quitting. You may build an application which does not end even with "normal" code, for example building a loop and inside having a DoEvents statement: if quitting before ending loop, App will not close. You should post more code if you want people here to look for a solution.
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
That's some 3rd party APIs
EHNDQ_setMode is to set a data transfer mode (from ASCII to EBCDIC, which is used in AS/400, which is one of the IBM mini machine);
EHNDQ_send is to send a message the the created data queue (like a message queue in the remote machine).
This program suppose to get information from SQL Server tables, join it to a string, then send to remote machine.
I've closed the DB things, and the remote data queue will start and stay there without the program runs.
When the program finished, It not in the applications any more, but still can be found in 'process' some how.
If you love it, you'll get it.
If you don't love it, you never get to it.