1. win32Lib and procedure free_console()

A code with win32Lib and procedure free_console() generate error message when run with Windows 7

C:\1USRE\DoisExe\exe1.exw:22 
<0074>:: Errors resolving the following references: 
	'free_console' (exe1.exw:22) has been declared more than once. 
		in c:/Euphoria/include/dll.e 
		in c:/Euphoria/include/std/console.e 
		free_console() 
   	                   ^ 

What can I do to resolve this?

new topic     » topic index » view message » categorize

2. Re: win32Lib and procedure free_console()

sergelli said...

A code with win32Lib and procedure free_console() generate error message when run with Windows 7

C:\1USRE\DoisExe\exe1.exw:22 
<0074>:: Errors resolving the following references: 
	'free_console' (exe1.exw:22) has been declared more than once. 
		in c:/Euphoria/include/dll.e 
		in c:/Euphoria/include/std/console.e 
		free_console() 
   	                   ^ 

What can I do to resolve this?

The include file std/console.e uses the console namespace. So you can correct this by calling free_console() like this:

include std/console.e -- namespace console 
console:free_console() 

-Greg

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

3. Re: win32Lib and procedure free_console()

ghaberek said...
include std/console.e -- namespace console 
console:free_console() 

-Greg

O.K. The error is resolved. But the black console keeps popping up.

Please, some kind soul:) could analyze what is wrong in my code????
Program one:

 
-- exe1.exw 
include WIN32lib.ew 
include std/console.e 
console:free_console() 
---------  Main ----------------------------------------	 
global constant WIN1 = create( Window, "exe1", 0, Default, Default, 222, 222, 0 ) 
setFont(WIN1,"Courier New",12,"Bold") 
setTimer( WIN1, 1, 10000 )   
-------------------------------------------------------------- 
procedure ontimer(integer self, integer event, sequence parms) 
		free_console() 
	system("exe2.exe",2) --  
		free_console() 
end procedure 
-------------------------------------------------------------- 
setHandler(WIN1, w32HTimer, routine_id("ontimer"))  
WinMain( WIN1, Normal ) 

Program Two -- remember that you need to compile the program 2

-- exe2.exw   -- please make an exe2.exe
include WIN32lib.ew 
include std/console.e 
console:free_console() 
---------  Main ---------------------------------------------------	 
constant TODO=command_line() 
        ,WIN2=create( Window,"Exe-2",0, Default, Default, 902, 449, 0 ) 
-------------------------------------------------------------------- 
procedure onOpenWIN2(integer self, integer event, sequence parms) 
	free_console() 
 self = message_box("Uuuuuh" ,"Mesage !", MB_ICONEXCLAMATION  + MB_TASKMODAL) 
	free_console() 
end procedure 
--------------------------------------------------------------------- 
setHandler(      WIN2, w32HOpen,     routine_id("onOpenWIN2")) 
if length(TODO)=2 then 
	WinMain(WIN2, Normal)          -- test exe2.exw 
elsif length(TODO)=3 then 
 onOpenWIN2(0,0,"")             -- call in exe1.exw 
elsif length(TODO)=4 then 
 onOpenWIN2(0,0,"")             -- to do 
elsif length(TODO)=5 then        
 onOpenWIN2(0,0,"")             -- to do 
end if 
new topic     » goto parent     » topic index » view message » categorize

4. Re: win32Lib and procedure free_console()

I noticed you were peppering free_console() everywhere to try and alleviate the problem. smile

Just use shellExecute() instead. It's part of Win32Lib and should do exactly what you need.

shellExecute( "open", "exe2.exe", SW_SHOWNORMAL ) 

I tested your code with this method and the black cmd window went away.

-Greg

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

5. Re: win32Lib and procedure free_console()

ghaberek said...

I noticed you were peppering free_console() everywhere to try and alleviate the problem. smile -Greg

Thanks Greg

The peppering ? Because I was hopeless, desperate... smile

This occurrence shows how useful this forum is. Sometimes, because of the excess concentration of thought in the routines, we forget some features.

But, the system() and system_exec(), could not be built to be equal to ShellExecute() from Derek?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu