* Re : Troubles with MessageBeep | Beep...
@ 1999-07-15 0:00 SEV, AV Guest 2
1999-07-15 0:00 ` Dale Stanbrough
0 siblings, 1 reply; 3+ messages in thread
From: SEV, AV Guest 2 @ 1999-07-15 0:00 UTC (permalink / raw)
As they say... RTFM...
Beep & MessageBeep are functions....
The following code is really annoying but it works...
------------------------------------------------------------------------
--
with Win32, Win32.WinUser, Win32.WinDef, gbObjects, Win32.WinBase;
use type Win32.Int, Win32.Bool, Win32.WinDef.hWnd;
use gbObjects, Win32.WinBase;
package Window1 is
Form : gbMainWindow;
Button1 : gbButton;
procedure Initialize_Form;
end Window1;
package body Window1 is
procedure Button1_Click is
b : Win32.bool;
begin
b:=Beep(5000,5000);
end Button1_Click;
procedure Initialize_Form is
begin
Button1.Click := Button1_Click'Access;
Text(Button1, "Button1");
SetFont(Button1, "MS Sans Serif", 8, gbFalse, gbFalse, gbFalse);
Move(Button1, 44, 39, 137, 47);
Text(Form, "Window1");
SetFont(Form, "MS Sans Serif", 8, gbFalse, gbFalse, gbFalse);
Move(Form, 3, 126, 229, 152);
Visible(Form, gbTrue);
end Initialize_Form;
begin
Initialize_Form;
end Window1;
with gbObjects;
with Window1;
procedure Main is begin
gbObjects.gbStartApplication;
end Main;
------------------------------------------------------------------------
-----
Sorry if I waste your time with this....
Thnx anyway, Bart.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Troubles with MessageBeep | Beep...
1999-07-15 0:00 Re : Troubles with MessageBeep | Beep SEV, AV Guest 2
@ 1999-07-15 0:00 ` Dale Stanbrough
0 siblings, 0 replies; 3+ messages in thread
From: Dale Stanbrough @ 1999-07-15 0:00 UTC (permalink / raw)
SEV, AV Guest 2" <avguest2@barco.com> wrote:
" procedure Button1_Click is
b : Win32.bool;
begin
b:=Beep(5000,5000);
end Button1_Click;"
Why does it return a boolean?
On a related note, when I am calling a lot of Unix functions, and
don't want to check the return value, I sometimes do the following...
declare
Result : Natural;
begin
Result := F1 (...);
Result := F2 (...);
exception
when constraint_error => <function failed>
end;
...so would
subtype Ok is Boolean range true..true;
Ok := Beep (...);
compile without the constraint check being optimised away (
would that be a legal optimisation)?
Dale
^ permalink raw reply [flat|nested] 3+ messages in thread
* Troubles with MessageBeep | Beep...
@ 1999-07-15 0:00 SEV, AV Guest 2
0 siblings, 0 replies; 3+ messages in thread
From: SEV, AV Guest 2 @ 1999-07-15 0:00 UTC (permalink / raw)
I want to use API functions|procedures|types|constants
in my future ADA-projects,
I added User32.lib (aplib) to my project files
---------------------------------------------
with win32; --general
use win32;
with win32.winuser; --Messagebeep
use win32.winuser;
with win32.winbase; --Beep
use win32.winbase;
package sound is
procedure bell;
end sound;
package body sound is
procedure bell is
begin
Beep(1000, 1000);
MessageBeep(MB_ICONASTERISK);
end bell;
end sound;
with sound;use sound;
procedure main is
begin
bell;
end main;
--------------------------------------------
The result I get from the compiler is as follows:
(ObjectAda for Windows V7.1.105 (proffesional edition)
(Copyright (c) 1997, Aonix. All Rights Reserved.)
--------------------Target: Win32 (Intel) Debug--------------------
sound.ada: Error: line 15 col 5 LRM:5.1(4), Procedure call, entry call,
or code statement expected, Continuing
sound.ada: Error: line 16 col 5 LRM:5.1(4), Procedure call, entry call,
or code statement expected, Continuing
Front end of sound.ada failed with 2 errors. (0 Warnings)
Tool execution failed.
------------------------------------------------------------------------
---------
If I replace Bell(1000,1000); by Beep(1000); The compiler tells me :
sound.ada: Error: line 15 col 5 LRM:6.4.1(3), Parameter mismatch in
call, missing actual for param dwDuration.
Isn't that a contradiction....
Does anyone know a solution to this problem...
Thnx,Bart.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-07-15 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-15 0:00 Re : Troubles with MessageBeep | Beep SEV, AV Guest 2
1999-07-15 0:00 ` Dale Stanbrough
-- strict thread matches above, loose matches on Subject: below --
1999-07-15 0:00 SEV, AV Guest 2
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox