[fpc-pascal]Yet another bug in Win32 CRT unit

Ivan Montes senbei at terra.es
Fri Mar 8 23:43:37 CET 2002


From: "Rich Pasco" <pasco at acm.org>


Maybe making a loop in another thread or hooking an int (if it's possible in
Win32),
this loop calls beep(freq_x, 1) when sound is called and not when nosound is
called.
But anyway I think it's more simple to just drop a compile warning when
using this
function in Win32.

> Here's a beeping program that compiles under Borland Pascal for DOS
> and Free Pascal for Win32 and sounds the same on both.  What eludes
> me is how to code a unit that implements sound() and delay() by calling
> windows.beep().
>
>      - Rich
>
> {$ifdef WIN32}
>   uses Windows;
> {$else}
>   uses CRT;
> {$endif}
>
> begin
> {$ifdef WIN32}
>   beep(1000,1000);
>   beep(500,1000);
> {$else}
>   sound(1000);
>   delay(1000);
>   sound(500);
>   delay(1000);
>   nosound;
> {$endif}
> end.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





More information about the fpc-pascal mailing list