Close NewLisp console window

Notices and updates
Locked
santy
Posts: 5
Joined: Wed Nov 19, 2008 7:01 pm
Location: Ukraine, Lviv
Contact:

Close NewLisp console window

Post by santy »

Hi all.

Now I am testing my gui library. It works very good but newlisp console window is always open.

How can I close this window?

Thanks.

newBert
Posts: 156
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Post by newBert »

Here is a solution: put these lines at the beginning of the script to hide the console window

Code: Select all

(import "kernel32.dll" "FreeConsole") 
(FreeConsole) 
Or create a shortcut for the script with this in the target field :"C:\Program Files\newlisp\guiserver.jar" 47011 "<name_of_the_script>.lsp"
(right click on the created shortcut and select properties, then modifiy the field "target")

P.S.: assuming that you are on Windows, of course

:-)
BertrandnewLISP v.10.7.6 64-bit on Linux (Linux Mint 20.1)

santy
Posts: 5
Joined: Wed Nov 19, 2008 7:01 pm
Location: Ukraine, Lviv
Contact:

Post by santy »

Sorry, but this code do not work.
I do not use guiserver.
[/img]

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

on windows use ->

Code: Select all

(import "kernel32.dll" "FreeConsole")
(FreeConsole) 
or arnt you using window? or "what" version are you using?
-- (define? (Cornflakes))

santy
Posts: 5
Joined: Wed Nov 19, 2008 7:01 pm
Location: Ukraine, Lviv
Contact:

Post by santy »

I am using windows XP SP3

it is given code:

Code: Select all

(import "kernel32.dll" "FreeConsole") 
(FreeConsole)

(load "sgui.lsp")

(define (menu_demo)
 
 (set 'iWindows (sgui:CreateWin 100 200 195 260 (address "Menu demo Window") ( | sgui:WF_SystemMenu sgui:WF_TitleBar sgui:WF_MinimizeWidget sgui:WF_MaximizeWidget sgui:WF_SizeWidget)))
 ;(println iWindows (number? iWindows)) 
 (if (not (null? iWindows)) 
   (begin 
      (set 'mainMenu (sgui:CreateMainMenu iWindows))
      ;(println mainMenu (number? mainMenu)) 
      (if (not (null? mainMenu))
        (begin   
        (sgui:CreateMenuTitle "File")  
          (sgui:CreateMenuItem 1 "Open")
          (sgui:CreateMenuItem 2 "Save")
          (sgui:CreateMenuItem 3 "Close")
          (sgui:CreateMenuSeparator)
          (sgui:CreateMenuItem 6 "&Exit") 
         (sgui:CreateMenuTitle "Edit")  
          (sgui:CreateMenuItem 118 "Undo")
          (sgui:CreateMenuItem 9 "Redo")
          (sgui:CreateMenuItem 10 "Find")
          (sgui:CreateMenuSeparator)
          (sgui:CreateMenuItem 12 "Find Files") 
        ) 
       )
       (while (!= EventID sgui:WE_CloseWindow)
        (set 'EventID (sgui:StartWinEvent))
       ) 
    (sgui:CloseWin iWindows)
   )
 )
) 

(menu_demo)
(exit)

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

yes the documentation mentions "providing the full path" when using import..
Please try that for the kernel32.dll ...
-- (define? (Cornflakes))

newBert
Posts: 156
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Post by newBert »

I think you should put

Code: Select all

(import "kernel32.dll" "FreeConsole")
(FreeConsole) 

in the first file, I mean in this case at he beginning of sgui.lsp

I used to act in that way with runtk.lsp...

P.S.: By the way, does the file sgui.lsp have something to do with wxWidgets ?
BertrandnewLISP v.10.7.6 64-bit on Linux (Linux Mint 20.1)

xytroxon
Posts: 296
Joined: Tue Nov 06, 2007 3:59 pm
Contact:

Post by xytroxon »

Here are three hidden MSdos box launch programs...

From the GTK-server download page:
http://www.gtk-server.org/download.html

Is a link to:
RUN - Run & Stop
http://www.turtle.dds.nl/run/

Which has links to:
CMDOW - Commandline Window Utility [v1.4.3]
http://www.commandline.co.uk/cmdow/

And:
CHP - Create Hidden Process
http://www.commandline.co.uk/chp/

-- xytroxon
"Many computers can print only capital letters, so we shall not use lowercase letters."
-- Let's Talk Lisp (c) 1976

newBert
Posts: 156
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Post by newBert »

Xytroxon, thanks for CHP !
It works fine and easily in a batch file.

:-)
BertrandnewLISP v.10.7.6 64-bit on Linux (Linux Mint 20.1)

santy
Posts: 5
Joined: Wed Nov 19, 2008 7:01 pm
Location: Ukraine, Lviv
Contact:

Post by santy »

to xytroxon

Program work good with CHP.exe.

Thanks.

to newBert
sgui is my little gui library. At this time I am writing wrapper for newLisp.

P.S. May be Lutz Mueller add new option in the newlisp program for gui application.

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post by pjot »

You can also compile your newLisp interpreter with the '-mwindows' compile option. Then there will be no DOS box.

So in 'makefile_mingw' add this to the CFLAGS line:

CFLAGS = -Wall -pedantic -Wno-long-long -c -O1 -g -DWIN_32 -mwindows

But it's a Win32 problem only, of course.

Regards

newBert
Posts: 156
Joined: Fri Oct 28, 2005 5:33 pm
Location: France

Post by newBert »

newBert wrote:Xytroxon, thanks for CHP !
It works fine and easily in a batch file.

:-)
However it seems not to work (neither does CMDOW besides) with a GTK based newlisp script.
RUN.EXE must be the best solution in this case.
BertrandnewLISP v.10.7.6 64-bit on Linux (Linux Mint 20.1)

santy
Posts: 5
Joined: Wed Nov 19, 2008 7:01 pm
Location: Ukraine, Lviv
Contact:

Post by santy »

Sorry but CHP.exe works bad.

I took source code newlisp (v 10.0.1) and modified it.
Code compiled in old IDE MinGW Developer Studio.


Code and program (without console window) are here
http://santysoft.narod.ru/programs/file ... ewlispw.7z

and sample program for build exe module from NewLisp code is here
http://santysoft.narod.ru/programs/file ... ild_exe.7z

Thanks.

Locked