Board index » delphi » Yield doesn't seem to work in Delphi on Win95

Yield doesn't seem to work in Delphi on Win95

I have a delphi dll function that uses winexec to start programs and
then wait for their completion.  To allow the program to function
I use the Yield win16 api call in a loop.  This worked fine under
Windows 3.11, but Yield does not seem to work anymore under Windows
95.

Eg:      hInst := WinExec('program.exe', 0);
         Repeat
            Yield;
         Until GetModuleUsage(hInst) = 0;  

A work around or any help on this one would be much appreciated.

Regards Charles van Velsen

Email: cvc...@onthenet.com.au

 

Re:Yield doesn't seem to work in Delphi on Win95


Charles van Velsen <cvc...@onthenet.com.au> writes:

Quote
>I have a delphi dll function that uses winexec to start programs and
>then wait for their completion.  To allow the program to function
>I use the Yield win16 api call in a loop.  This worked fine under
>Windows 3.11, but Yield does not seem to work anymore under Windows
>95.
>Eg:      hInst := WinExec('program.exe', 0);
>         Repeat
>            Yield;
>         Until GetModuleUsage(hInst) = 0;  

Instead of Yield, us Application.ProcessMessages, which executes a
PeekMessage loop.

Luke
--
Luke Webber

* Note: The opinions expressed by Luke Webber are in no way supported *
*       by his employers, Luke Webber Consulting Services             *

Re:Yield doesn't seem to work in Delphi on Win95


Quote
l...@ozramp.ozramp.net.au (Luke Webber) wrote:

> Charles van Velsen <cvc...@onthenet.com.au> writes:

> >I have a delphi dll function that uses winexec to start programs and
> >then wait for their completion.  To allow the program to function
> >I use the Yield win16 api call in a loop.  This worked fine under
> >Windows 3.11, but Yield does not seem to work anymore under Windows
> >95.

> >Eg:      hInst := WinExec('program.exe', 0);
> >         Repeat
> >            Yield;
> >         Until GetModuleUsage(hInst) = 0;  

> Instead of Yield, us Application.ProcessMessages, which executes a
> PeekMessage loop.

> Luke
> --
> Luke Webber

> * Note: The opinions expressed by Luke Webber are in no way supported *
> *       by his employers, Luke Webber Consulting Services             *
> The application object does not exist in my dll as there are no
> Forms, only exported functions.  
> Charles van Velsen

Re:Yield doesn't seem to work in Delphi on Win95


Quote
>   Charles van Velsen <cvc...@onthenet.com.au> writes:
>  I have a delphi dll function that uses winexec to start programs and
>  then wait for their completion.  To allow the program to function
>  I use the Yield win16 api call in a loop.  This worked fine under
>  Windows 3.11, but Yield does not seem to work anymore under Windows
>  95.

>  Eg:      hInst := WinExec('program.exe', 0);
>           Repeat
>              Yield;
>           Until GetModuleUsage(hInst) = 0;  

>  A work around or any help on this one would be much appreciated.

>  Regards Charles van Velsen

>  Email: cvc...@onthenet.com.au

Besides Application.processmessages you can use:
var
begin
        ...
TranslateMessage(msg);
DispatchMessage(msg);
        ...
end;

I'm telling you this because the forms unit adds worthless bytes to your .exe or dll
(if you just need to include Application.ProcessMessages to your code)

Other Threads