Page 1 of 1

code snippets collected from this board

Posted: Mon Aug 16, 2004 8:38 pm
by Lutz
This is a file I am keeping for some time now, collecting useful little functions from the board: http://www.newlisp.org/index.cgi?page=Code_Snippets

Lutz

Posted: Tue Aug 17, 2004 6:57 am
by HPW
Good start and nice that you link it under 'Tips and Tricks'.
(BTW: Why no navigation footer on this page?)

Posted: Thu Nov 10, 2005 8:04 pm
by Fanda
There is an error in the last example: Run a Win32 shell and hide window

I believe that function should be:

Code: Select all

(define (winexec) 
  (import "shell32.dll" "ShellExecuteA")
  (apply ShellExecuteA (args)))
(Maybe we don't even need to import the ShellExecuteA every time...)

This make this function... -> makes

--------

Would anybody know how to hide window of newlisp.exe right from the start? (So it is completely invisible.)
Any possible way - using batch file, some parameters for newlisp.exe, ... ???

Thank you, Fanda

Posted: Thu Nov 10, 2005 11:01 pm
by Lutz
The code snippet in http://newlisp.org/index.cgi?page=Code_Snippets (last item) defines the function 'winexec' correctly. The construct with 'args' is not necessary. The defined 'winexec' can be used directly after importing it when using as shown in the header of the code snippets. This is not a lambda function definition, but 'define' here is used as a 'setq'

Code: Select all

(define winexec 
   (import "shell32.dll" "ShellExecuteA"))

;; is equivalent to

(set 'winexec (import "shell32.dll" "ShellExecuteA"))
but the first form of the assignment documents better the itention of creating a function. See the documentation for 'define' in the manual.

Lutz

Posted: Fri Nov 11, 2005 6:48 am
by Fanda
Thanks for explaining. Somehow it didn't work for me the first time. I have tried to recreate the situation when it didn't work, but now it is OK every time :-)))

----------

So, does anybody know how to hide the window of newlisp.exe right from the start?

Thank you, Fanda

PS: Lutz, you forgot to change the date of "last updated 2005-08-18".
And, please excuse me for posting mostly errors, or what I think are the errors.

Posted: Fri Nov 11, 2005 8:28 am
by pjot
Hi Fanda,

You can hide the DOSBOX in which newLisp starts with my 'run'-tool:

http://www.turtle.dds.nl/run/index.html


Or, you could recompile newLisp with MinGW, after editing the file 'makefile_mingw'. You have to add '-mwindows' to the link flags.

Peter

Posted: Fri Nov 11, 2005 3:22 pm
by Fanda
Thanks Peter, it works!

I don't usually deal with the system-level stuff, so it would take me ages to figure that out :-)))

Fanda