I am creating a website application which requires keyboard input, specifically without browser focus.
Without giving too much away about my great application idea (=P), I want to respond (even to just a single) keyboard key press, with the understanding that the browser will not have focus.
I have been doing a great deal of studying on this front, and I have found much help with keyboard 'hooks', so that no matter which application has focus, I can react to key inputs (the ones I have been playing with are in vc#). And these work, for executables, but I am not sure how to get them into the browser with my web application.
What my question is: Can I use ActiveX (or anything of that ilk - wpf?) to get access to keyboard input regardless of the browser having focus or not.
Thanks so very much for your time, I would love to learn if this type of thing is even possible, before wasting my time learning how to create and use ActiveX (just to learn that it is not).
theLizardPosted Nov 4, 2010, 4:27 PM
OK, what will the function do and does or will the function run on the client, can the function be one that runs at the server?
Why I ask this is that, maybe, you could write a keyboard monitor that has a http element to it and when a key that you to intercept is pressed you could relay to the function on your server and return a response to your keyboard monitor which in turn parses it on to the active browser or possibly direct to the browser, it may be hard to do but worth looking at.
p.s. I use C++ Builder, C# is a play thing for me and only used for web site.
gee kayPosted Nov 4, 2010, 3:59 PM
My main starting place would be to see if there is a way to write a _______ (Im not sure if you have said activeX or wpf, or by which means you recommend that I start researching)
as far as what I want to do, specifically, in psudo-
if (key == '1'){ runfunction() };
runfunction could literally just output the key to a textfield for all that I mind, or send it in a msg box (sorry I am very new to C#, so I have no idea if there is a better 'echo/print' function for this type of app).
ps. Thanks again theLizard for your patience with me on this issue, I very much look forward to your response.
theLizardPosted Nov 3, 2010, 6:10 PM
gee kayPosted Nov 3, 2010, 3:04 PM
Is this possible to do within the browser? If so; is that an activeX type of thing?
I have a great little script which works in C#.... I just have no clue if I could use it in a web browser- or even where to begin.
However- Rest assured that I am a very quick learner- I just need to be pointed in the right direction.
THANKS SO MUCH again for your time on this issue!!
-GK
theLizardPosted Nov 2, 2010, 10:17 PM
But without knowing what you want to do with the key press it's hard to know which way to go.
gee kayPosted Nov 2, 2010, 8:34 PM
Thanks so very much for your time on this issue,
-GK
theLizardPosted Nov 2, 2010, 8:07 PM
On the other hand if you want to do this while the browser has focus you can do it using java script
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function testnumeric(e) {
var o = window.event ? event : e //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
var unicode = o.charCode ? o.charCode : o.keyCode
var k = String.fromCharCode(unicode)
var ok = 0;
var s = '';
var i = parseInt(k);
if (i >= 0 || i <= 9) {
buttonClick(document.getElementById('d' + k).innerText);
}
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is a method I used to see what keys on the numeric key pad were pressed I am sure you can figure out how to get any key.
Hope this helps you some way.
gee kayPosted Nov 2, 2010, 7:54 PM
If a mod is on, please feel free to move it to any section where it is most likely to be answered!! THANKS FOR YOUR TIME!!!