comp.lang.ada
 help / color / mirror / Atom feed
* API-timer...
@ 1999-07-27  0:00 SEV, AV Guest 2
  1999-07-27  0:00 ` API-timer Martin C. Carlisle
  0 siblings, 1 reply; 2+ messages in thread
From: SEV, AV Guest 2 @ 1999-07-27  0:00 UTC (permalink / raw)


I would like to use an API-timer in my future projects... the following
source compiles but the executable doesn't do what I want...
Has anyone experience with this...

------------------------------------------------------------------------
---------------
with win32, win32.winbase, win32.winuser;
with Ada.Unchecked_Conversion;
with Text_IO;
with System;

package Test is
  Result		  : Win32.Uint;
  Val		  : String (1..80);
  Len		  : Integer;
  procedure Tik (a : integer);
  function Convert is new Ada.Unchecked_Conversion
       (Win32.LPVoid,Win32.WinUser.TIMERPROC);
  procedure Drop;
end Test;

package body Test is

  procedure Tik (a: integer) is
    Result : Win32.Bool;
  begin       
    Result:=Win32.Winbase.beep(win32.ulong(a),500);
  end Tik;

  procedure Drop is
  begin
    Result:=Win32.Winuser.SetTimer(null,0,1000,Convert(Tik'address)); 
    Text_IO.Get_Line(S.Val,S.Len);
  end Drop;

end Test;

with Test;
procedure Main is
begin
  Test.Drop;  
end Main;
------------------------------------------------------------------------
--------------





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: API-timer...
  1999-07-27  0:00 API-timer SEV, AV Guest 2
@ 1999-07-27  0:00 ` Martin C. Carlisle
  0 siblings, 0 replies; 2+ messages in thread
From: Martin C. Carlisle @ 1999-07-27  0:00 UTC (permalink / raw)


In article <2461CF0DA7DBD211B07300805F921CBC0203768D@kuumex03.barco.com>,
SEV, AV Guest 2 <avguest2@barco.com> wrote:
>I would like to use an API-timer in my future projects... the following
>source compiles but the executable doesn't do what I want...
>Has anyone experience with this...

I've not used that particular call before, but I'm pretty sure you'll
have to make sure your procedure is using the pragma Convention(Stdcall,...)

Using an unchecked conversion prevents the compiler from telling you things
like this!  Get rid of that and use procedure'access instead.  (Probably 
should be a function).

I use a timer w/o a callback (using messages) in AdaGIDE.  You can get the
source from http://wuarchive.wustl.edu/languages/ada/swtools/adagide

--Martin

-- 
Martin C. Carlisle, Asst Prof of Computer Science, US Air Force Academy
carlislem@acm.org, http://www.usafa.af.mil/dfcs/bios/carlisle.html
DISCLAIMER:  This content in no way reflects the opinions, standards or 
policy of the US Air Force Academy or the United States Government.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-07-27  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-27  0:00 API-timer SEV, AV Guest 2
1999-07-27  0:00 ` API-timer Martin C. Carlisle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox