From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,511884c4d439ef8 X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: key strokes intercept Date: 1999/03/31 Message-ID: #1/1 X-Deja-AN: 461277980 References: <370160f9.569041534@news.dsuper.net> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1999-03-31T00:00:00+00:00 List-Id: fluffy_puff@dsuper.net writes: > Hi, > > I'm taking a programming course, using Ada 95, and I've played with VB > and C++ before. In Visual Basic I could use some pre-defined > subprograms to control key strokes in real time (as they happened, as > opposed to after the key has been pressed): KeyDown, KeyUp, > KeyCode, stuff like that. KeyDown, KeyUp, KeyCode etc are Windows events. Visual Basic provides a nice framework for handling events nicely. Plain Ada does not; you need a thick binding to Windows to get that. I'm writing one called Windex; after you learn some more about Ada, you could try it. See my web page: http://www.erols.com/leakstan/Stephe/index.html The version there now does not provide access to the Key events, but I just added that over the weekend, so check back soon (I'll announce here when I release a new version). In the meantime, it will give you a taste of what you are in for; don't be too scared, it gets easier after you learn more. Look at the example Mandelplot application, not the Windex code itself. It has handlers for mouse events; key events will work similarly. > > How do I do this in Ada ? I just need sort of a starting point where > I can look for the info. I have a beginner level book that's pretty > good but doesn't touch this topic at all. I couldn't find anything > either in the online help I have. You need to get a good intro to Windows. I recommend Charles Petzold's book (I think the title is "Programming Windows 95"). This will explain about Windows events etc. > What is "GNAT" ? A free Ada compiler; you can download it from ftp://cs.nyu.edu/pub/gnat/. For the Windows version, see the winnt/ directory; works nicely for Windows NT and Windows 95; should work with Windows 98. > All I can say about the compiler I use is what the "About" box shows: > ObjectAda for Windows V7.1.105 (special edition) > Copyright (c) 1997, Aonix. This is another free Ada compiler, but it has several limitations (it is old, has some known bugs, and will only compile relatively small programs). I recommend downloading Gnat; it has a nice install script, and is in some ways better than even the current version of ObjectAda. On the other hand, Aonix does make a GUI builder that is trying to be like Visual Basic (it has a _long_ way to go), so if you're interested in helping them along, go buy the version of ObjectAda that provides the GUIBuilder. Check their website at: www.aonix.com (hmm, doesn't seem to be up right now). > Thanks You're welcome; hope this helps. -- Stephe