code snippets collected from this board

Notices and updates
Locked
Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

code snippets collected from this board

Post 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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Good start and nice that you link it under 'Tips and Tricks'.
(BTW: Why no navigation footer on this page?)
Hans-Peter

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post 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.

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

Post 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

Fanda
Posts: 253
Joined: Tue Aug 02, 2005 6:40 am
Contact:

Post 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

Locked