473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Querying presence of a keyboard

Hi,
Is there any way to query whether or not a keyboard is attached to a pc
please?
My software will be running on XP/Vista systems in an environment where
there may or may not be a keyboard/mouse attached to the system.

thank you
Jul 19 '07 #1
6 1926
I don't know the answer to the question, but I would not think it was
necessary to know the answer to accomplish what you are required to do.

If you have some code XYZ that needs to be executed at some time by a user
action, then presumably the code is executed from some event handler, such as
a button click or keyboard shortcut. It sounds like you will need to make
sure that there is some form of handler for setups where neither of these
could occur, perhaps from a voice activation event? Your mouse and keyboard
handlers just won't be called in this configuration.

"Claire" wrote:
Hi,
Is there any way to query whether or not a keyboard is attached to a pc
please?
My software will be running on XP/Vista systems in an environment where
there may or may not be a keyboard/mouse attached to the system.

thank you
Jul 19 '07 #2

"Claire" <cc@nospam.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,
Is there any way to query whether or not a keyboard is attached to a pc
please?
SetupDiCreateDeviceInfoList passing GUID_DEVCLASS_KEYBOARD

I highly recommend using C++/CLI for this as C# code for using C-style
structures with pointers is somewhat unwieldy.
My software will be running on XP/Vista systems in an environment where
there may or may not be a keyboard/mouse attached to the system.

thank you

Jul 19 '07 #3
Forgive me for sounding simplistic, but if there is no keyboard / mouse
attached to a machine running your program then how do you propose to get
user input?
The "sounds" like the classic joke,

"Keyboard not found. Press F1 to continue."

-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Claire" wrote:
Hi,
Is there any way to query whether or not a keyboard is attached to a pc
please?
My software will be running on XP/Vista systems in an environment where
there may or may not be a keyboard/mouse attached to the system.

thank you
Jul 19 '07 #4
Obviously it will come from the same way the user launched the program... :)

"Peter Bromberg [C# MVP]" wrote:
Forgive me for sounding simplistic, but if there is no keyboard / mouse
attached to a machine running your program then how do you propose to get
user input?
The "sounds" like the classic joke,

"Keyboard not found. Press F1 to continue."

-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Claire" wrote:
Hi,
Is there any way to query whether or not a keyboard is attached to a pc
please?
My software will be running on XP/Vista systems in an environment where
there may or may not be a keyboard/mouse attached to the system.

thank you

Jul 19 '07 #5
Lol! in reply to comments about keyboards/mice.
My application is written for touch screen and operates in different modes
depending on user type logging into the system.
Regular users log in at reception using a card via a cardreader and have a
touch screen, admins would normally have an installation with mouse and
keyboard.
I thought it would be nicer to test whether hardware was absent and display
an onscreen keyboard automatically rather than force someone to press an
onscreen button to access it.
thank you :)
Jul 20 '07 #6
"Claire" wrote:
Hi,
Is there any way to query whether or not a keyboard is attached to a pc
please?
My software will be running on XP/Vista systems in an environment where
there may or may not be a keyboard/mouse attached to the system.

thank you

Would the WMI class Win32_Keyboard be useful in this case?

http://msdn2.microsoft.com/en-US/library/aa394166.aspx

-Tim Sprout
Jul 20 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: skearney | last post by:
When I was in boy scouts, as part of learning Morse code, I was told that the inventor of the typewriter originally put the letter 'e' under the left middle finger, just below its present position....
6
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about...
13
by: Steve Jorgensen | last post by:
Well, it seems that Microsoft, or whatever powers that be have decided it's time for us to have yet another standard keyboard layout change. I think I see that the point of this one was to reduce...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
7
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it...
0
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
2
by: RajSharma | last post by:
Hi, I am facing a problem regarding querying thru a large table having millions of rows....... Its hanging in between while querying for all those rows Can anybody suggest me a query regarding :...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.