[comp.windows.ms] Spawning another App

rossh@umd5.umd.edu (Hollis "NeXT-Dood" Ross) (09/19/89)

I recieved many requests for the information on 'spawning' 
another App, so I dug up the info which was given to me at 
the Microsoft U. Windows class.  Do to the fact that the 
files were .arc, I had to wait till I could get a copy of 
PKUNPAK from someone.  After unpacking the file I discovered
that it is not a program, but rather a transcript of a 
conversation on some BBS, possibly Compuserv.  The 'solution'
is a mention of the use of 'spawnl()' in the very last 
paragraph. The poster claims to have succesfully used spawnl() 
to start another App.  I tried this, and the only thing that 
I got was a request from windows for a pif file for my app. 
I am including the entire file from MSU in the hope that 
someone here on the net might be able to figure out what we 
need to do to spawn a process.  I can't spend any more time 
on this, as I have a project due soon. 

Hollis Ross. 

================================================================================
"Gozer the Gozarian, as a duly appointed represenative   | rossh@umd5.umd.edu
 of the, State, County and City of New York, I do hereby | Bitnet: rossh@umdd
 command you to cease all paranormal activity and return |---------------------
 forthwit to your place of origin, or the nearest 	 | Bill the cat says
 convient parallel dimension" -  Ghostbusters	 	 | "Just say Ack!"
================================================================================


--------------------------------------------------------------------------
#: 67995 S1/Windows Developers
    14-Jul-87  13:27:55
Sb: Windows multitasking
Fm: kevin easterbrook 71500,2677
To: Sysop

I am looking for a little inof on Windows multitasking.  I know that Windows
supports multitasking, but I am wondering if it is possible for an application
to spawn another application without the user going through the Executive
window (i.e user selects an option from the current menu and a new application
is started).
                       Kevin Easterbrook [71500,2677]


Function: 


#: 68007 S1/Windows Developers
    14-Jul-87  14:16:29
Sb: #67995-Windows multitasking
Fm: Sysop David Moskowitz 76701,100
To: kevin easterbrook 71500,2677 (X)

Kevin, I think the answer to your question is yes and no <grin>.  If you mean
is it POSSIBLE for a WinApp to Spawn another task without using the Windows
function, then I believe the answer should be NO.  However, there isn't a
whole lot that will stop you.  Of course the resulting system may crash <grin>

If you are talking about a non-WinApp then it will execute in the leftover
memory allocated to the task (based upon the PIF file. Is there enough room?

Just out of curiosity, what are you trying to do?

David




#: 68013 S1/Windows Developers
    14-Jul-87  14:39:40
Sb: #67995-#Windows multitasking
Fm: Noel J. Bergman 73220,1030
To: kevin easterbrook 71500,2677 (X)

Kevin,

In a word, "Yes".


        --- Noel



* Reply:
        68022

#: 68022 S1/Windows Developers
    14-Jul-87  15:12:42
Sb: #68013-Windows multitasking
Fm: kevin easterbrook 71500,2677
To: Noel J. Bergman 73220,1030

Thank you for the quick and volumous response...my next question as you may
have guessed is how???  I have seen no documentation that deals with this
subject.  Is it as simple as registering another window, creating the window
and showing the window, or is there a kit routine for spawning another
process?
                              Kevin

* RR 68013

#: 68024 S1/Windows Developers
    14-Jul-87  15:20:34
Sb: #68007-Windows multitasking
Fm: kevin easterbrook 71500,2677
To: Sysop David Moskowitz 76701,100

I think you have missed the point of the question...I WANT the spawned
application to use the window function.  What I don't wnat is for the user to
be forced to start up another instance of the MSDOS Executive and select a new
application from the Executive directory. Is it possible for the user to
select a menu item that will cause a new window to be registered, created and
shown and if so how?
                           Kevin


#: 68027 S1/Windows Developers
    14-Jul-87  15:34:28
Sb: #68007-Windows multitasking
Fm: kevin easterbrook 71500,2677
To: Sysop David Moskowitz 76701,100

By the way ... jsut for your info... I am working on a front end processor for
a software modeling and simulation tool. This processor (being developed with
Windows for in house use) will allow a user to graphically represent
thehardware and software architecture of the the system being modeled.  The
user will build flow charts representing the system and enter the
specifications for each node in the chart.  When the entire system is defined
a processor will convert the model into an input file for the modeling program
which runs on a MicroVAX.
                               Kevin


#: 68054 S1/Windows Developers
    14-Jul-87  18:08:29
Sb: #68022-Windows multitasking
Fm: Mike Ramsden 74206,1501
To: kevin easterbrook 71500,2677 (X)

I don't know exactly HOW to do it, but if you look at the clickstart demo ( if
either dl1 or dl6 (can't remember exactly where) you can see it very well
demonstrated. ClickStart puts up a front end that allows you to start up other
WinApps, as well as non winaps, and does it quite nicely.
.Mike


#: 68060 S1/Windows Developers
    14-Jul-87  18:29:21
Sb: #67995-Windows multitasking
Fm: Dennis Williamson 73260,350
To: kevin easterbrook 71500,2677 (X)

Here is a _partial_ list of Windows applications that spawn other Winapps:
 
        Windows MS-DOS Executive !!!
        In*a*Vision (spawns template app, Control Panel or another instance of
                itself)
        Click-Start (spawns user-specified application)
        Pagemaker (spawns Control Panel, Spooler or Clipboard)
        .
        .
        .
 
Presumably, the ability of PM and In*a*Vision to spawn what they do is because
in some cases they are distributed with a run-time version of Windows which
does not include the MS-DOS Executive.


#: 68091 S1/Windows Developers
    14-Jul-87  21:01:16
Sb: #68060-Windows multitasking
Fm: Ed McNierney 71560,365
To: Dennis Williamson 73260,350

Well, you're probably in for a surprise....  have you considered the MS-DOS
EXEC function?  That's all you have to use - just exec the other program as if
you were running a non-Windows program which was execing another non-Windows
program.
 
In fact, the program you spawn does not need to be a WinApp.  If it isn't,
Windows will behave just as if you had selected the non-WinApp from the MS-DOS
Executive.  But that's all the Executive does to run other programs.
 
I am not, however, sure that the MSC C library exec () and spawn () functions
are properly palatable to Windows.  I've only used an assembler interface (not
very hard to do, but if the library works it's easier).
 
        - Ed
 


#: 68124 S1/Windows Developers
    14-Jul-87  22:57:02
Sb: Windows multitasking
Fm: Noel J. Bergman 73220,1030
To: Dennis Williamson 73260,350

Dennis,

Check out page 122 of the Windows Programming Guide.


        --- Noel




#: 68215 S1/Windows Developers
    15-Jul-87  11:57:37
Sb: #68054-Windows multitasking
Fm: kevin easterbrook 71500,2677
To: Mike Ramsden 74206,1501

I cannot find the ClickStart demo in either of the Windows data libraries.  I
have even looked for it on the GEnie BBS and couldn't find it there either. 
Perhaps it is cataloged under a different name?
                           Kevin


#: 68219 S1/Windows Developers
    15-Jul-87  12:58:32
Sb: #68215-Windows multitasking
Fm: Noel J. Bergman 73220,1030
To: kevin easterbrook 71500,2677

Kevin,

It's in DL 0.  All new uploads go there for the first 30 days to make it
easier to find them.  BROwse CLK*.* to see them.

If you have any trouble spawning another application, let me know.


        --- Noel




#: 68271 S1/Windows Developers
    15-Jul-87  19:28:03
Sb: #68024-Windows multitasking
Fm: kent cedola 73277,3616
To: kevin easterbrook 71500,2677

As I believe, a Window Application call execute the EXEC (4BH) DOS
interrupt to start another Window Application.  This was in a message
long ago from Microsoft.  I have forgotten if it tried it or not.
I have traced some of the MS-DOS.EXE (Windows Application) code and
found Windows functions that deals with Tasks that are not in the
documentation.  MS-DOS.EXE calls one of them called StartTask (or
LoadTask, something like that).  I asked MS about them, but no
response.  I hope that Windows 2.0 will document these functions.
(look at the WINEXP.H for some of the hidden Windows functions that
deals with tasks).


#: 68339 S1/Windows Developers
    16-Jul-87  00:41:06
Sb: #68091-Windows multitasking
Fm: Sky Schulz / Island Grfx 73250,1403
To: Ed McNierney 71560,365

Ed -
        You can't use the MSC library functions exec() or spawn(), just
continue to use the assembler interface.
                                        - Sky


#: 68340 S1/Windows Developers
    16-Jul-87  00:41:17
Sb: #68060-Windows multitasking
Fm: Sky Schulz / Island Grfx 73250,1403
To: Dennis Williamson 73260,350

Dennis (& all) -
        The "Executive" is a part of the Kernel of MSW and is, in a word,
'inseperable' from the rest of MSW.  If you have a "run-time" version of MSW,
you *have* MSW!


        To get the rest of MSW added to you "run-time" version, go into the
sub-directory where WIN.COM is located and type this:


        C> ECHO foo > MSDOS.EXE


        This creates the dummy file 'MSDOS.EXE' which is all you need to round
out your MSW installation.
                                        - Sky


#: 68429 S1/Windows Developers
    16-Jul-87  13:06:59
Sb: #68091-Windows multitasking
Fm: Dennis Williamson 73260,350
To: Ed McNierney 71560,365

Right you are!  When I was using the word 'spawn' I was not referring to the C
function but to the _result_, independent of the method.


Function: 


#: 68504 S1/Windows Developers
    16-Jul-87  19:24:00
Sb: #68340-Windows multitasking
Fm: Dennis Williamson 73260,350
To: Sky Schulz / Island Grfx 73250,1403

It doesn't seem to work with In*a*vision (it doesn't have a win.com, it has
invision.com).  I'm going to try it with Balance of Power when I get a chance.
I am assuming you mean to create this dummy file after windows is installed.


#: 68693 S1/Windows Developers
    17-Jul-87  13:25:23
Sb: #68504-Windows multitasking
Fm: Sky Schulz / Island Grfx 73250,1403
To: Dennis Williamson 73260,350

Dennis -


        Yes.  Create the dummy file after installing MSW.  Also, I think I mad
a typo and called the dummy file "WIN.COM", it should be "WIN.EXE".


                                        - Sky


#: 68714 S1/Windows Developers
    17-Jul-87  15:56:58
Sb: Windows multitasking
Fm: kevin easterbrook 71500,2677
To: SYSOP

I would like to thank all those who responded to my question on Windows
multitasking.  With your help I was indeed able to spawn another WinApp
(multiple WinApps in fact) from within my own application. - I was able to do
it using the spawnl routine in the standard C library. The call I used was
spawnl (P_WAIT, pathname, pathname, NULL); I tested the code by starting up
and closing multiple windows applications from my application.  All the
spawned applications worked fine. - Just for kicks I tried specifying
P_OVERLAY as the disposition of the parent...it didn't work (which is what I
would expect). The application that was currently running locked up.

 - Again thanks for the help.
                             Kevin

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (09/22/89)

Why such a rumour about spawning other applications ?

Simply use spawnlp() or a similar call from the C library (the windows
version of course) with a P_WAIT or P_NOWAIT parameter.
If you want to start a program but to stay in foreground, simply
use SetFocus(hWnd) immediately after the spawnlp() call.

I use this method in a replacement program for the MSDOS executive
and until now I did not have any problems.

Kai Uwe Rommel

bturner@hpcvlx.cv.hp.com (Bill Turner) (09/25/89)

> Why such a rumour about spawning other applications ?
> 
> Simply use spawnlp() or a similar call from the C library (the windows
> version of course) with a P_WAIT or P_NOWAIT parameter.

As someone else pointed out, if memory is compacted while in the spawnlp,
your program will die a horrible death.  Any of these methods should be
surrounded by LockData/UnlockData.

--Bill Turner (bturner@hp-pcd.hp.com)
HP Corvallis Information Systems