Launching Windows Program from DOS Program 
Author Message
 Launching Windows Program from DOS Program

Does anyone know of a way to launch a Windows program from within a DOS
BASIC 7.1 application in a way that will allow the calling program to
keep running. For example, you can use the SHELL command to launch an
instance of Winamp with a filename on the command-line. WinAmp will
appear in a window and start playing the file. However, the DOS program
is frozen until the user exits WinAmp. Is there some other way to get it
done so WinAmp continues running in it's Window while the DOS program
also continues in it's window???

Thanks!



Mon, 05 Jul 2004 04:43:27 GMT  
 Launching Windows Program from DOS Program
Try using

Shell "start winamp"


Quote:
> Does anyone know of a way to launch a Windows program from within a DOS
> BASIC 7.1 application in a way that will allow the calling program to
> keep running. For example, you can use the SHELL command to launch an
> instance of Winamp with a filename on the command-line. WinAmp will
> appear in a window and start playing the file. However, the DOS program
> is frozen until the user exits WinAmp. Is there some other way to get it
> done so WinAmp continues running in it's Window while the DOS program
> also continues in it's window???

> Thanks!



Mon, 05 Jul 2004 05:24:34 GMT  
 Launching Windows Program from DOS Program

Quote:

> Try using
> Shell "start winamp"

Also...

"Start" is the equivalent of the dubleclick in Windows, so even
documents (such as help fils or HTMLs) can be opened via that.

--
Cellphone: 0038631752815

Don't feel bad about asking/telling me anything, I will always gladly
reply.

Digging for info? Try AI Meta Search:
Http://WWW.AIMetaSearch.Com

MesonAI -- If nobody else wants to do it, why shouldn't we?(TM)
Http://WWW.MesonAI.Com



Mon, 05 Jul 2004 21:33:37 GMT  
 Launching Windows Program from DOS Program


Quote:
> However, the DOS program
> is frozen until the user exits WinAmp. Is there some other way to get it
> done so WinAmp continues running in it's Window while the DOS program

Use a small .VBS wrapper script:

Instread invoke

SHELL "winamp"

directly, write a file called WAMPWRAP.VBS containing

' Wrapper
Option Explicit
Dim oSh

Set oSh = CreateObject(WScript.Shell)
oSh.Run "winamp", 1, False
Set oSh = Nothing
WScript.Quit

Especially the last parameter in the Run method drives if the program should
be started in the fore- (True) oder background (False).

In QBasic, just invoke this script with

SHELL "wscript wampwrap.vbs"

Note: Install the latest Internet Explorer to get the most recent Windows
Script Host version.

      Andreas



Tue, 06 Jul 2004 20:48:41 GMT  
 Launching Windows Program from DOS Program
This is an interesting idea that I haven't tried yet. Thanks for the suggestion!

In case anyone else cares, I tried the "START WINAMP.EXE" suggestion and it
failed. I did get it to work exactly as I wanted though, buy using the command:

"CMD /C WINAMP.EXE filename.mp3"

Thanks for the suggestions!

Quote:



> > However, the DOS program
> > is frozen until the user exits WinAmp. Is there some other way to get it
> > done so WinAmp continues running in it's Window while the DOS program

> Use a small .VBS wrapper script:

> Instread invoke

> SHELL "winamp"

> directly, write a file called WAMPWRAP.VBS containing

> ' Wrapper
> Option Explicit
> Dim oSh

> Set oSh = CreateObject(WScript.Shell)
> oSh.Run "winamp", 1, False
> Set oSh = Nothing
> WScript.Quit

> Especially the last parameter in the Run method drives if the program should
> be started in the fore- (True) oder background (False).

> In QBasic, just invoke this script with

> SHELL "wscript wampwrap.vbs"

> Note: Install the latest Internet Explorer to get the most recent Windows
> Script Host version.

>       Andreas



Sat, 10 Jul 2004 23:08:50 GMT  
 Launching Windows Program from DOS Program

Quote:

>This is an interesting idea that I haven't tried yet. Thanks for the suggestion!

>In case anyone else cares, I tried the "START WINAMP.EXE" suggestion and it
>failed. I did get it to work exactly as I wanted though, buy using the command:

>"CMD /C WINAMP.EXE filename.mp3"

CMD only works on Win2000/XP/NT

For Windows95/98 you need to use COMMAND instead.
(Which should also work on 2000/XP/NT)

--
Marc van den Dikkenberg
--
The powerbasic Archives -- http://www.xlsior.org



Sun, 11 Jul 2004 11:28:39 GMT  
 Launching Windows Program from DOS Program

Quote:
>CMD only works on Win2000/XP/NT
>For Windows95/98 you need to use COMMAND instead.
>(Which should also work on 2000/XP/NT)

Marc,

Was it you or someone else who pointed out the difference once between
the CMD and COMMAND?

What was it again?



Sun, 11 Jul 2004 13:52:39 GMT  
 Launching Windows Program from DOS Program
CMD.EXE is a 32-bit command-interpreter, COMMAND.COM is 16-bit.

However, neither filename should ever be "hard-coded" into an
application as such code may fail when the system is using other
brands of command interpreters (4DOS comes to mind, but there are
others).

The solution is to ask the O/S for the name of the command-interpreter
to use, for example:

SHELL ENVIRON$("COMSPEC") + " /C DIR *.* > filename.txt"

Quote:


>>CMD only works on Win2000/XP/NT

>>For Windows95/98 you need to use COMMAND instead.
>>(Which should also work on 2000/XP/NT)

>Marc,

>Was it you or someone else who pointed out the difference once between
>the CMD and COMMAND?

>What was it again?

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Mon, 12 Jul 2004 06:27:49 GMT  
 Launching Windows Program from DOS Program

Quote:

>CMD.EXE is a 32-bit command-interpreter, COMMAND.COM is 16-bit.
>However, neither filename should ever be "hard-coded" into an
>application as such code may fail when the system is using other
>brands of command interpreters (4DOS comes to mind, but there are
>others).
>The solution is to ask the O/S for the name of the command-interpreter
>to use, for example:
>SHELL ENVIRON$("COMSPEC") + " /C DIR *.* > filename.txt"

Lance

I've just got them both on my Win NT4 system, and wondered why.

Are there any specified times when you'd use one or the other, or are
you safe to always use the 32-bit one?



Mon, 12 Jul 2004 10:44:07 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Converting a DOS program to a WINDOWS program

2. Launching a DOS program

3. Launching DOS programs from VB

4. Launching MS-DOS from with in a Visual Basic Program

5. Having a BASIC program launch another program

6. How to launch a VB program off the back of a non VB program

7. Registry read Failure when program launched by AT scheduling program

8. Launching external Windows Programs

9. Create .EXE file to launch a windows program?

10. VB6 program becomes a DOS program when compiling

11. About executing DOS programs in a VB program...

12. HELP!. Communication between DOS programs and VB programs

 

 
Powered by phpBB® Forum Software