programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: A run once and exit EXE

From: Tom Dixon <u0087651_at_utah.edu>
Date: Mon, 22 Dec 2003 15:28:52 -0700

Hello,

I have a simple solution for your problem. The MCI command strings allow for
you to wait for a media file to end before returning, you only have to specify
the command "wait" at the end of the string (ie: z" play sample.wav wait"
mcicommand drop)

Here is the media-player code modified for an executable:

library winmm.dll
4 import: mciSendString
create returnstring 256 allot
0 value returnvalue
: mcicommand returnstring 255 returnvalue mciSendString ;

: main ( -- ) CMDLINE drop mcicommand drop 0 exitprocess ;

' main 'main !
program c:\mcicomm.exe

then from the dos prompt, you can play it by:
"mcicomm play sample.wav wait"
and it should do what I understand you want.

I hope this may help.

-Tom Dixon

Quoting Richard Owlett <rcowlett_at_atlascomm.net>:

> Using "Play an MP3 file in six line of code" from the FAQ as an
> example I wrote
>
>
> library winmm.dll
> 4 import: mciSendString
> create returnstring 256 allot
> 0 value returnvalue
> : mcicommand returnstring 255 returnvalue mciSendString ;
> : doesit z" play c:\atest\ding.wav" mcicommand drop ;
> starter doesit
> program c:\atest\playaudio.exe
>
> It does what I want but doesn't exit cleanly.
> I know I have to do some housekeeping, but can't remember what or
> where to find.
>
>
> ----------------------------------------------------------------------
> sftalk_at_forth.com The SwiftForth programming discussion email list
> To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
> For list command help, send subject "help" to sftalk-request_at_forth.com
> Message archives are located at http://www.forth.com/archive/sftalk
> ----------------------------------------------------------------------
> This list is a forum for SwiftForth users. For product support and bug
> reports, please send email to support_at_forth.com
> ----------------------------------------------------------------------
>
>

--
----------------------------------------------------------------------
sftalk_at_forth.com      The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users.  For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Mon Dec 22 2003 - 14:30:02 PST

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:11 PST