From: G DOT DegliEsposti AT ads DOT it To: djgpp AT delorie DOT com Message-ID: Date: Thu, 23 Apr 1998 15:36:29 +0200 Subject: Re: Interfacing to a MS-Windows application: How ? Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk >> something like 'system("simulation.exe")' will probably work here >> as suggested by Eli Zaretskii (thanks !) > >Not ``system("simulation")'', use ``system("start simulation")''. The >latter won't stop Excel in its tracks until the simulation returns. I This is true, but I think excel needs to know when the simulation ends. >suppose there is a way to run external programs from Excel, and you >should use that way to run the DJGPP program via "start". This will run >it in a separat DOS box, while Excel is free for whatever else you need >it. When the simulation is over, just load the file of results into >Excel. Probably the clipboard can be used for sinchronization pourposes. IIRC there is a standard window message like "WM_CLIPBOARDCHANGED" (or something like this :-) If it is possible to intercept this message using exel scripts then the work is mostly done: When simulation.exe has ended, it writes to disk and using the clipborad it can tell exel to go on. I try to explain myself better: Excel script simulation.exe write to disk input data start simulation.exe -------> read input data from disk wait for clipboard changed ... ... write to file the results get the clipboard changed message <----- write to clipboard read the file. IIRC DDE is (or was) based on clipboard too, so this way should be possible, maybe not easy but possible. >> 2) The DJGPP simulation-program needs a MS-win app to do some >> calculations for it. For example, we need to lookup a value from a large >> MS-Access data-base (or from an Excel spread-sheet). >> >> How to do this is not clear to me. Can I use Libwin for this purpose ? > >Libwin will not help, AFAIK, since it does not (and cannot) make a DJGPP >program compatible with Windows apps. Libwin just lets you access some >Windows features from a DJGPP program. You can read the registry, >interface to the clipboard, set your DOS box title, etc. This all >doesn't help you a bit top communicate with a Windows app; since you said >that the results are huge, the clipboard won't help since access to it >from DJGPP programs is limited to about 600KB (you need a buffer in lower >memory to pass data to and from the clipboard). > >The easiest way to accomplish this second task is to make the programs >communicate through disk files. Then you have the DJGPP program run the >Windows application, and then read the results from a file. Ugly, but it >should work. There are still problems in sinchronization... I don't know if Libwin allows interception of windows messages, but it seems very difficult, so the clipboard approach would not be available... Maybe some "sinchronization" is possible if simulation.exe is freezed until excel has ended its execution. I don't know enough about how system() works in a dos box under win95 to say more. ciao Giacomo