From: dbe AT wgn DOT net ($Bill Luebkert) Subject: Re: Problem with GetKeyState() 6 Nov 1997 03:58:30 -0800 Message-ID: <34619CA3.7B4A61AD.cygnus.gnu-win32@wgn.net> References: <0008EF83 DOT 3272 AT fhssmtp DOT redstone DOT army DOT mil> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: GBradfor Cc: gnu-win32 AT cygnus DOT com GBradfor wrote: > > What is wrong with the following program? > > > It is compiled under bash with > gcc -o keystate.exe keystate.c -I$GCC_WIN_INCLUDE -luser32 > > where GCC_WIN_INCLUDE is an environment variable pointing to the Windows32 > directory. > > As I understand the documentation on this function, GetKeyState() takes the > ASCII code for A-Z, a-z, and 0-9 as input (the virtual-key code for > others). It returns a value where the high-order bit is set for key down, > and it is reset for key up. The low-order bit is set and reset for > "toggle-able" keys. > > Given this, and that 0x61 is ASCII for 'a', I would think that the program > would print the opening statement, wait for 'a' to be struck, print the > next two statements, wait for 'a' to be released, and print the last > statement. > > This ain't happening. The program prints the first statement and hangs. > > What am I misunderstanding here? I don't claim to be an expert or anywhere close to it, but methinks this routine is only valid when running as a Windows task (not in console mode). Course I don't know much more than that. :) Someone else can explain how to create a windows app. -- ,-/- __ _ _ $Bill Luebkert (_/ / ) // // DBE Collectibles / ) /--< o // // http://www.wgn.net/~dbe/ -/-' /___/_<_