Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Keyboard Event Handling

Posted on 2003-12-03
9
Medium Priority
?
707 Views
Last Modified: 2010-04-16
Hi,
I like to develop a small test application in which while the program is running in the background, if a certain keyboard combination is detected a message box will popup.

Say for example, Control 5.  This needs to be done while the program is running but not neccessarily in focus. I can be in Iexplorer and i hit Control F5 and the message box pops up but the program shouldnt refocus.

any suggestions with the KeyUp/Down events i can find useful? I am in a bit of a pickle.

thanks
0
Comment
Question by:jwnrb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:rogaut1
ID: 9868923
Hi,

   I think this is what you are looking for : http://www.developerfusion.com/show/271/



Hope this helps !



Robert
0
 
LVL 2

Expert Comment

by:rogaut1
ID: 9868940
0
 
LVL 2

Accepted Solution

by:
rogaut1 earned 1000 total points
ID: 9868953
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:jwnrb
ID: 9869156
Hmm, it appears to work however when the prog is minimised the text box is also minimised on the tray. how can i force the messagebox.show event to pop up in the middle of the screen no matter whats open
0
 

Author Comment

by:jwnrb
ID: 9869308
Hmm, also, it seems this code is quite complicated. Anything else simpler?
Like this:

private void txtTest_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
            {
                  if(e.KeyCode == Keys.D5 && e.Modifiers == Keys.ControlKey) // Ctrl+5
                  {
                        MessageBox.Show("You pressed the special key combination.  Good for you!","Key Catcher",MessageBoxButtons.OK, MessageBoxIcon.Information);
                  }
            }

but works in the background and on the form itself (this code doesnt actually work yet but the jist of it)
0
 
LVL 2

Expert Comment

by:rogaut1
ID: 9869512
No, the KeyDown event works only when your form has the focus.
0
 

Author Comment

by:jwnrb
ID: 9869545
Oh, so the only other way is to use what you provided?  Okay, I cant seem to find in the src then where i can decided which key stroke combinations i want to invoke the event.
also how can i cause a messagebox to take over the screen (like being an obnoxious popup more or less)

0
 

Author Comment

by:jwnrb
ID: 9869932
Just realised where to change the hot key. my bad.
anyways, i cant figure out the message box so it popups over in the application whre it was called
0
 

Author Comment

by:jwnrb
ID: 9870120
Well my boss likes it thus far and wants me instead of the msgbox, wants text to be sent from the program to an application.

such that, if i am in Word, Excel, Notepad, etc, a predefined string of text would be sent to the program and typed out such, "hello" for example and the program can not lose focus.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question