Article View: comp.windows.ms.programmer
Article #293Re: Unwanted Multitasking!!
From: Natawut Nupairoj
Date: Fri, 10 Apr 1992 18:57
Date: Fri, 10 Apr 1992 18:57
32 lines
1730 bytes
1730 bytes
In article <1992Apr10.133656.28981@ugle.unit.no>, jlongva@Siri.Unit.NO (J|rgen Longva) writes:
|>
|> The external routine must pass data back to the windows-program, and I
|> use the hard disk as a buffer:
|>
|> // Executes the external routine.
|> if (WinExec("routine.exe", SW_HIDE) < 32)
|> --> Error
|>
|> // Reads the information returned by the external routine.
|> if ((file = _open("info.txt", O_RDWR)) == -1)
|> --> Error
|>
|> ...
|>
|> The problem is that the main-program continues to run - and reaches the
|> line where I open the result-file too early. I've made a .pif-file for
|> the externl routine that checks the "Exclusive"-flag for priority.
|>
|> How can I check when the external routine is finished? Is there an al-
|> ternative to WinExec(...) (the LoadModule(...) does only work for win-
|> dows .exe-files)?
There are 2 ways to solve this:
1. Use yield() function (proably don't work)
2. Have some synchronization ie: the external routine create a special file
when it completes its job. Your main program have to check this file.
Yeah, it does not look great but I think it works.
Natawut Nupairoj.
Technical Details
Message-ID:
<1992Apr10.185750.5569@msuinfo.cl.msu.edu>Path:
arc1-ca.pugleaf.net!sparky!news.UU.NET!van-bc!wolfe.wimsey.bc.ca!rsoft!agate!ames!elroy.jpl.nasa.gov!ncar!uchinews!msuinfo!tuna.cps.msu.edu!nupairojReferences:
<1992Apr10.133656.28981@ugle.unit.no>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer,comp.windoes.ms Path: arc1-ca.pugleaf.net!sparky!news.UU.NET!van-bc!wolfe.wimsey.bc.ca!rsoft!agate!ames!elroy.jpl.nasa.gov!ncar!uchinews!msuinfo!tuna.cps.msu.edu!nupairoj From: nupairoj@tuna.cps.msu.edu (Natawut Nupairoj) Subject: Re: Unwanted Multitasking!! Message-ID: <1992Apr10.185750.5569@msuinfo.cl.msu.edu> Sender: news@msuinfo.cl.msu.edu Organization: Dept. of Computer Science, Michigan State University References: <1992Apr10.133656.28981@ugle.unit.no> Date: Fri, 10 Apr 92 18:57:50 GMT Lines: 32