I have a desktop application form which i am launching another application and closing current one.
Current application is closing but i can still see its process in task manager due to which i am not able to delete that exe from launched application.
i am using ‘Quit’ to close my application.
Can anyone help me to close application completely ?
It sounds like your app is waiting for the launched app to close, what code did you use to launch the other app?
Does this work for you in a new test project?
Dim f As New FolderItem("C:\WINDOWS\system32\notepad.exe")
f.Open() 'f.Launch if you are using <2019r2.1
If you do the same as the above, do you have anything in Application.CancelClose that could be stopping the quit?
Does your app close OK if you comment out the code that starts the other application?
i am using f.Launch to open another app.
i think its only happening on Windows 7, as it works on couple of Windows 10 machines.
One thing i figured out is i am launching another application from my first form’s Activate event. Is that causing a problem ?
What version of Xojo are you using and what version of Windows 7?
i am using Xojo 2019 r1 and Windows 7 Professional
Launching from the Opening windows Activate event shouldn’t matter.
Did you try the code I posted above? Did it show the same problem?
I’ve just tested it here on 2019r1.1 on Windows 7 Ultimate with SP1 without any problems.
Are you able to replicate it on a sample test project or are you able to post some of the code you’re using?
If you comment out of the Launch line does the program shut down correctly?
What is the full version number from your widows 7 install on System Information?
Are you actually using 2019r1 or 2019r1.1 ?
Please try to answer all the questions I ask including from previous messages
It should be noted that Windows doesn’t do any checking to see if the app is already running like macOS does, so if that first app doesn’t quit and is brought to the foreground again, you’ll get another instance of the second app.
I’ve seen this happen when working on Windows builds. Windows users used to report it happening with my apps too, after quit. Since then, in all my apps I’ve use this method, which solves the problem …
Public Sub KillWindowsProcess()
// kill the app, only on Windoze
// this works but may not be 64-bit compatible
' #if TargetWin32 then
' Declare Function GetCurrentProcessId Lib "Kernel32" () As UInt32
' dim PID as UInt32 = GetCurrentProcessId()
' dim s as new shell
' s.Execute("Taskkill /PID " + str(PID) + " /F")
// this works for both 32-bit and 64-bit builds
' and will not kill any same-named applications
dim s as new shell
dim p as new WindowsProcessStatisticsMBS
dim pID as integer = p.ProcessID
s.Execute("Taskkill /PID " + str(pID) + " /F")
… which gets called as the last command in App.Close
' stop lingering process on Windows
#if TargetWin32 then
App.Log( "Killing Windows process" )
This way there is never a lingering process after quitting on Windows.