1. How close one program from another.

Hello my fellow Euphorians,

My next stupid question is,

How can I close one program from another?

Let's say I'm running an Euphoria program and Notepad.

Or an Euphoria program and another Euphoria program that I have compiled to an .exe file.

How can I close the second program from the first?

Don Cole

new topic     » topic index » view message » categorize

2. Re: How close one program from another.

I think you could find a way using sendMessage(). Perhaps there is some close Window message. You'll need to somehow get the handle of the Window you wish to close though.

new topic     » goto parent     » topic index » view message » categorize

3. Re: How close one program from another.

DonCole said...

How can I close one program from another?

Let's say I'm running an Euphoria program and Notepad.

Or an Euphoria program and another Euphoria program that I have compiled to an .exe file.

How can I close the second program from the first?

Assuming the program you want to close always has a proper window, try Edita\eama.ew (see the comments in that file)

In the case of Notepad, you would want to tweak it to look for window titles ending in " - Notepad".

Pete

new topic     » goto parent     » topic index » view message » categorize

4. Re: How close one program from another.

DonCole said...

Hello my fellow Euphorians,

My next stupid question is,

How can I close one program from another?

Let's say I'm running an Euphoria program and Notepad.

Or an Euphoria program and another Euphoria program that I have compiled to an .exe file.

How can I close the second program from the first?

Don Cole

Hi, this is 'one' solution to the problem.. There are different ways to do that.

include tinewg.exw 
include std/math.e 
 
sequence WindowText="Editor" -- German version of Windows 
-- sequence WindowText="Notepad" -- Maybe this one for a English version 
 
Window("Close Test") 
 
constant b1=Control(Button,"Start Notepad",160,50,80,30) 
constant b2=Control(Button,"End Notepad",160,80,80,30) 
 
procedure run() 
	RunApp("Notepad.exe","") 
end procedure 
SetHandler(b1,Click,routine_id("run")) 
 
procedure endapp() 
atom handle=0 
sequence handles 
	handles=EnumWindows() 
	for i=1 to length(handles)  do 
		if and_bits ( GetWindowLong (handles[i],GWL_STYLE), or_all ({WS_VISIBLE,not_bits(WS_POPUP)})) then 
			if match(WindowText,GetText(handles[i])) then 
				handle=handles[i] 
				exit  
			end if 
		end if 
	end for  
	if handle then 
		if AskMsg("Really Close :"&GetText(handle),"Close App") then 
			SendMessage(handle,WM_CLOSE,0,0) 
		end if 
	else 
		InfoMsg("Not found","Close App")	 
	end if 
end procedure 
SetHandler(b2,Click,routine_id("endapp")) 
 
WinMain() 
 

Also it is written using tinewg, it should be easy to convert it to any other wrapper.
Andreas

new topic     » goto parent     » topic index » view message » categorize

5. Re: How close one program from another.

andi49 said...

Hi, this is 'one' solution to the problem.. There are different ways to do that.

include tinewg.exw 
include std/math.e 
 
sequence WindowText="Editor" -- German version of Windows 
-- sequence WindowText="Notepad" -- Maybe this one for a English version 
 
Window("Close Test") 
 
constant b1=Control(Button,"Start Notepad",160,50,80,30) 
constant b2=Control(Button,"End Notepad",160,80,80,30) 
 
procedure run() 
	RunApp("Notepad.exe","") 
end procedure 
SetHandler(b1,Click,routine_id("run")) 
 
procedure endapp() 
atom handle=0 
sequence handles 
	handles=EnumWindows() 
	for i=1 to length(handles)  do 
		if and_bits ( GetWindowLong (handles[i],GWL_STYLE), or_all ({WS_VISIBLE,not_bits(WS_POPUP)})) then 
			if match(WindowText,GetText(handles[i])) then 
				handle=handles[i] 
				exit  
			end if 
		end if 
	end for  
	if handle then 
		if AskMsg("Really Close :"&GetText(handle),"Close App") then 
			SendMessage(handle,WM_CLOSE,0,0) 
		end if 
	else 
		InfoMsg("Not found","Close App")	 
	end if 
end procedure 
SetHandler(b2,Click,routine_id("endapp")) 
 
WinMain() 
 

Also it is written using tinewg, it should be easy to convert it to any other wrapper.
Andreas

Where can I find os.e and tinEWG_const.ew that go with tinewg.exw?

Don Cole

new topic     » goto parent     » topic index » view message » categorize

6. Re: How close one program from another.

DonCole said...

Where can I find os.e and tinEWG_const.ew that go with tinewg.exw?

Don Cole

Hi

tinewg is OE 4.x only. os.e is part of OE 4.x, It's in the Standard Library
tinEWG_const.ew should be in every download with tinewg.exw.

You may visit http://euphoria.indonesianet.de

There is a downloadpage. If you follow the link to bitbucket you can download the most reason version of tinewg.

If you do not have OE 4.x installed on your Computer, you may give setup.exe or setup.zip a try. This files are bundled with a OE 4.1 setup.

This installations do (hopefuilly ;) )not harm your current Euphoria installations.

Say, you have installed setup.exe, then you can start the edit program (a very simple Editor) and just copy and paste the code from the forum to the Editor and choose 'Run' in the menue.

tinewg is developed on a Win8 64bit machine since a few month, i sometimes do tests installations on a WinXP SP2 machine.
I do not know if it works on Vista,Win7 or even Wine (also it worked about 2 month ago on Wine/Slackware 14).

Hope this answers your question.
Andreas

new topic     » goto parent     » topic index » view message » categorize

7. Re: How close one program from another.

andi49 said...
DonCole said...

Where can I find os.e and tinEWG_const.ew that go with tinewg.exw?

Don Cole

Hi

tinewg is OE 4.x only. os.e is part of OE 4.x, It's in the Standard Library
tinEWG_const.ew should be in every download with tinewg.exw.

You may visit http://euphoria.indonesianet.de

There is a downloadpage. If you follow the link to bitbucket you can download the most reason version of tinewg.

If you do not have OE 4.x installed on your Computer, you may give setup.exe or setup.zip a try. This files are bundled with a OE 4.1 setup.

This installations do (hopefuilly ;) )not harm your current Euphoria installations.

Say, you have installed setup.exe, then you can start the edit program (a very simple Editor) and just copy and paste the code from the forum to the Editor and choose 'Run' in the menue.

tinewg is developed on a Win8 64bit machine since a few month, i sometimes do tests installations on a WinXP SP2 machine.
I do not know if it works on Vista,Win7 or even Wine (also it worked about 2 month ago on Wine/Slackware 14).

Hope this answers your question.
Andreas

Thank you Andreas,

You answered enough for me to see that I'm better off not messing with it.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu