Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sat Nov 18, 2017 8:50 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu May 22, 2008 11:18 am 
Offline

Joined: Tue May 20, 2008 10:42 am
Posts: 6
Hi,

I am trying to trap the EMG, F1-F6, and the directional arrow control in my C# program. I have tried overriding the OnKeyPress Event and also the OnKeyDown Event, but that does not seem to work.

I have set up my CE Windows Form object to hide the task bar, and not to have a title bar (caption). I am hoping to restrict all user interaction to dialogs initiated from button presses or list box selections on the form as well as presses of the 7 function keys + the directional controller.

I noticed that when my form is running (consuming the entire screen), that when I press the EMG key, my form gets hidden and the TREQ's device directory is displayed. I would certainly like to know how to prevent that as well as to receive notification that the EMG key has been pressed!

I have tried searching this forum for "Function Keys", "F1", etc. but I always get a message about the search string being too general.

Thanks in advance for any help,
Chris Hough


Top
 Profile  
 
PostPosted: Thu May 22, 2008 2:50 pm 
Offline

Joined: Tue May 20, 2008 10:42 am
Posts: 6
I have done some poking around in the include files on the SDK and it seems as though I need to use the DeviceIoCtl command, but I would really appreciate it if I could see a code snippet that would show how to assign a value to, say, the EMG key, that could then be trapped in my C# app with OnKeyPress() or some other input event.

I would also be interested in the correct signature for using the DeviceIoCtl API from C#.

Am I correct in assuming that setting the values for these keys must be done every time the Application runs (as opposed to their being persistent) ?

Thanks,
Chris Hough


Top
 Profile  
 
PostPosted: Thu May 22, 2008 3:55 pm 
Offline
Site Admin
Site Admin
User avatar

Joined: Wed Mar 08, 2006 12:35 pm
Posts: 31
Location: Salt Lake City, Utah
Chris,

Please refer to the TREQ-L User Guide, section 5.3.1 (page 40), which discusses the keypad driver and how to use the DeviceIoControl interface to remap keypad keys. Code examples are also provided in this section.
http://www.qsicorp.com/pdf/qsi_treq-l_user_manual.pdf

Remapping keys through this interface (e.g. via the IOCTL_KEYPAD_SET_KEY control) will cause a change to the current key mapping and a corresponding setting in the device registry (also described in section 5.3.1). The registry is persistent, thus your key mappings are persistent, even after power has been removed and reapplied.

The EMG key (TREQ_KEY0) can be remapped from its default function (VK_RUN_APP) to another keycode, such as VK_F1 using the DeviceIoControl interface with the IOCTL_KEYPAD_SET_KEY control code. In your message pump for your application, you would then intercept WM_KEYDOWN messages and filter based on the keycode that was pressed.

QSI provides a set of C# wrappers for the C++ DeviceIoControl calls. These are available for download from the following link:
http://www.qsicorp.com/engfiles/TREQ/Apps/TREQDriversNetCE_DLL.zip
Documentation for these wrappers is included in the zip file.

_________________
Brian Crofts

QSI Corporation

801-466-8770 x431

http://www.qsicorp.com


Top
 Profile  
 
PostPosted: Fri May 23, 2008 4:50 am 
Offline

Joined: Tue May 20, 2008 10:42 am
Posts: 6
Thank you very much for your reply - I should be all set now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group