|
#1
|
|||
|
|||
|
Closing Applications
So far I love Version 2! The ability to easily download multiple patch files is great!
I am trying to ensure than my application is closed before processing the patch file. I have tried using the examples for both the Window.EnumerateProcesses and Window.EnumerateTitles and have been unable to get my application to close. In version 1.0, I used the Close Program option, and it worked fine. What am I doing wrong! I'd preffer to force the program to shut down than prompting the user to close it. |
|
#2
|
||||
|
||||
|
In our update for TrueUpdate I use the following code:
Code:
-- These actions are performed when the Next button is clicked.
function IsProcessRunning(strName)
local tblProcesses = Window.EnumerateProcesses();
local bProcessFound = false;
local nProcessHandle = nil;
if(tblProcesses)then
local strProcessName;
local nHandle;
for nHandle, strProcessName in tblProcesses do
if(String.Find(strProcessName,strName,1,false) ~= -1)then
nProcessHandle = nHandle;
bProcessFound = true;
end
end
end
return bProcessFound;
end
local strMsg = "TrueUpdate is running and must be shut down in order to continue.\r\n";
strMsg = strMsg.."Please shut the application down and click Retry to continue.";
bKeepTrying = IsProcessRunning("TU20Design.exe");
while(bKeepTrying)do
local nRes = Dialog.Message("Notice",strMsg, MB_RETRYCANCEL,MB_ICONEXCLAMATION);
if(nRes == IDCANCEL)then
bKeepTrying = false;
Application.Exit();
else
bKeepTrying = IsProcessRunning("TU20Design.exe");
end
end
Code:
-- Try and close a names process. Return true if it was closed -- successfully or false if not. function CloseProcessIfRunning(strName) local bProcessClosedSuccessfully = false; local tblProcesses = Window.EnumerateProcesses(); local bProcessFound = false; local nProcessHandle = nil; if(tblProcesses)then local strProcessName; local nHandle; for nHandle, strProcessName in tblProcesses do if(String.Find(strProcessName,strName,1,false) ~= -1)then nProcessHandle = nHandle; bProcessFound = true; end end end if(bProcessFound and nProcessHandle)then -- Try a soft close: Window.Close(nProcessHandle,CLOSEWND_SENDMESSAGE); if(Application.GetLastError() ~= 0)then -- Try a hard close: Window.Close(nProcessHandle,CLOSEWND_TERMINATE); if(Application.GetLastError() == 0)then bProcessClosedSuccessfully = true; end else bProcessClosedSuccessfully = true; end end return bProcessClosedSuccessfully; end |
|
#3
|
|||
|
|||
|
Thats works great! Every time I try something new - I think this new release is even better. What do you think about the possibility of creating some type of Dependency Like code Like SUF 7? The server compnent could easily handle this - then a user could build a small initial installer - that would then execute the full TrueUpdate 2.0 Driven Installation. Perhaps this would better facilitate the "Download Dependency Components" On Demand Concept?
Thanks for the help! |
|
#4
|
||||
|
||||
|
Thanks for the great comments on TrueUpdate 2.0! We're really excited about it too.
We set out to create the most flexible and powerful software updating system available on the market, and keep the price down to a fraction of what Installshield and ZeroG charge for their product. Incidentally, and of course I'm naturally biased, but TrueUpdate 2.0 is head and shoulders above those offerings. There's very little that TrueUpdate 2.0 can't handle!
__________________
Check out the new MSI Factory 2.0! |
|
#5
|
||||
|
||||
|
Quote:
|
|
#6
|
|||
|
|||
|
Closing tray application
I'm using your code to close my application and its server. The server is a tray-application which is not visible at runtime. If I try to close the main program (which is visible), it works fine, but when I use the same code to close the tray app., it doesn't work.
Hope you can help me. Regards, Fabian van Schevikhoven CorepaQ Systems |
|
#7
|
||||
|
||||
|
Hi fabian. There has been a pretty hot thread going for a few days in the AMS6 forum on the exact same topic.
http://www.indigorose.com/forums/showthread.php?t=15026 Quote:
__________________
Yeah right. Who's the only one here who knows the illegal ninja moves from the government? ()))))))))o)))))))============================================== |
|
#8
|
|||
|
|||
|
Hi
I'm testing TrueUpdate software and I'm just in this Step. I want to close my application if it is running at the moment an update is available and user press a next button after accepting the license agreement. I tried this code with a sample windows form application made in .Net 2.0 and it works well but my application is like Messenger application. One feature of my application is that it has timers running in the background and those timers stop the application for closing; maybe because those timers run in separate threads. I need to use a more powerful instruction to dispose the application and all threads associated to it. What can I do? Kenny |
|
#9
|
|||
|
|||
|
closing my application
Hi
I found the answer This instruction does not work for me Window.EnumerateProcesses(); I was needing Window.EnumerateProcesses(false); Because the window of my application is not visible |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Utility Applications that are worth it! | Intrigued | General Chat | 13 | 01-22-2004 10:42 PM |
| Closing applications opened through Autoplay program | ChrisMan | AutoPlay Media Studio 4.0 | 0 | 06-24-2003 02:39 PM |
| Are the Templates for the 5 Sample Applications available for download? | francisq | AutoPlay Media Studio 4.0 | 2 | 12-17-2002 11:22 PM |
| Problem with program closing | davinci | AutoPlay Media Studio 4.0 | 6 | 08-21-2002 09:51 AM |
| Installing VB Applications Knoweldge Base Article | Support | Setup Factory 5.0 | 0 | 02-22-2000 01:00 PM |
All times are GMT -6. The time now is 07:46 AM.






Linear Mode

