Indigo Rose Software
  #1  
Old 03-09-2005
greenace greenace is offline
Forum Member
 
Join Date: May 2003
Posts: 20
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  
Old 03-09-2005
Brett's Avatar
Brett Brett is offline
Indigo Rose Staff Member
 
Join Date: Jan 2000
Posts: 2,001
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
However, that requires user interaction, so let's try this:

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
Hope that helps.
  #3  
Old 03-09-2005
greenace greenace is offline
Forum Member
 
Join Date: May 2003
Posts: 20
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  
Old 03-09-2005
Ted Sullivan's Avatar
Ted Sullivan Ted Sullivan is offline
Indigo Rose Staff Member
 
Join Date: Oct 2003
Posts: 825
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  
Old 03-10-2005
Brett's Avatar
Brett Brett is offline
Indigo Rose Staff Member
 
Join Date: Jan 2000
Posts: 2,001
Quote:
Originally Posted by greenace
What do you think about the possibility of creating some type of Dependency Like code Like SUF 7?
That can certainly be done already. Just look at the script in the SUF70 dependency's properties and use it in TU20. Using this method you can roll your own dependency checking system in no time.
  #6  
Old 02-22-2006
fabian fabian is offline
Forum Member
 
Join Date: Mar 2005
Posts: 4
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  
Old 02-22-2006
TJS's Avatar
TJS TJS is offline
Indigo Rose Customer
 
Join Date: Oct 2005
Location: MI
Posts: 522
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:
We looked into this one a bit and what everyone is saying is correct. Basically when an application is in the system tray, it becomes a child window of the window with the classname "Shell_TrayWnd". So it's IDs do change and therefore aren't regular top level windows any longer that can be accessed in the same way.
__________________
Yeah right. Who's the only one here who knows the illegal ninja moves from the government?

()))))))))o)))))))==============================================
  #8  
Old 02-06-2007
kymaita kymaita is offline
Forum Member
 
Join Date: Jan 2007
Posts: 12
Cool Closing Multithread Application

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  
Old 02-09-2007
kymaita kymaita is offline
Forum Member
 
Join Date: Jan 2007
Posts: 12
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
 

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


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.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software