Posted by Howard Casto on 23, 2001 at 4:44 PM:
In Reply to: Re: Esc and other key woes.... (a possible solution for you guys) posted by Cryofax on 23, 2001 at 2:12 PM:
Actually the api I use does catch them eventually, but it usually happens after the key has been sent to the application. And your right about the dll thing.... I've been looking into it, but I haven't found a good one yet.
I'll keep you posted.
: : In VB a form or acitve x app sut be in "keypreview" mode in order to catch keypresses before they go to the object/app that's in focus...
: Yeah but I believe that only works in the VB project and its subforms. Its not going to catch keypresses being sent to say, notepad.exe or something else without a global .dll hook for VB to reference. I thought that's what you were talking about. Thats what I was planning on writing.
: I've been researching all over the place and haven't seen anything that says you can do consistent global keyboard intercepting from within VB without an external DLL (and VB can't do true DLLs, only OLE DLLs, which won't work for this). If you have something to the contrary I'd really be curious to see it! :)
: - Cryo
: : unfortunately this only works about 95% as some progs hook and key input before it slips into another progs
: : the api call i use revolves around:....
: : Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
: : there's of course more to it than that, but to be honest im too lazy to look right now....
: : if your really interested on working on it yourself then i hunt up the documentation, ect for you...
: : but i'll probably get around to making it one of these years
: : :)
: : i have hunch that many emulators might do this as they use direct input, but it's not confirmed yet...
: : : Why would some keys "slip out"? Are you using a timer to poll the keyboard? Which API function are you using? I am interested in something like this but haven't gotten around to taking a crack at writing it, being busy with my own front-end project. So if you have something working :)
: : : - Cryo
: : :
: : : : However..... the nifty little api that i have put in the RD simulates keypresses regardless of what has focus and with a little work i could mod it to be used as a button remapper....
: : : : there would be some limitations however...
: : : : 1. VB can't tell the diff between lshift and rshift, ect...
: : : : 2. If I got it to work, a shift function would be very buggy if I could implient it at all.
: : : : 3. Even though I could trap most of the "original" keypresses, a few would be bound to leak out... (not a big deal unless you reassign your action button to esc or something silly like that)
: : : : 4. Another stand alone prog to deal with, and thus another thing to add to you bat file or startup folder.
: : : : :(
: : : : would there be any interest in this type of prog?
: : : : if i get enough responses i'll add it to my ever-increasing pile of "emulation stuff to do"
: : : : :)