473,396 Members | 1,989 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,396 software developers and data experts.

problem with start external application and hook keyboard

Hi,
I just write an application in C# that show an interface with five
button, each button starts an external application that it comes in
front of the main C# application with focus on. When the users finish
to use the external program and close it, under there is still the c#
application that let the user choose other software to start.
Now the problem is that sometimes I lost the focus of the external
application and so it becomes unsuable, and this happen when after
start the application I continue to press keyboard even if the
application is still loading.
I would like to find a way to disable completely the keyboard for C#
application, to avoid the problem, and then enable keyboard when
external application finish.
I try various way but is seems the problem is still there.

please any good advice?

thanks a lot

May 3 '07 #1
1 2980
There are quite a few ways you could go about solving this problem but
none will be perfect. As I see it you are always going to have trouble
with the application losing focus whether it is to your c# app or
something else. If you can change the app then you could make it so it
always receives key presses whether or not it has focus.

The simplest way to answer your question is to handle the Activate
event in the c# form and then imediatly set the focus back to the
other application using windows messages. I presume you are using
process to start the other application and so will be able to see when
the application exits.

On May 3, 9:09 am, cvaire...@mcgestioni.it wrote:
Hi,
I just write an application in C# that show an interface with five
button, each button starts an external application that it comes in
front of the main C# application with focus on. When the users finish
to use the external program and close it, under there is still the c#
application that let the user choose other software to start.
Now the problem is that sometimes I lost the focus of the external
application and so it becomes unsuable, and this happen when after
start the application I continue to press keyboard even if the
application is still loading.
I would like to find a way to disable completely the keyboard for C#
application, to avoid the problem, and then enable keyboard when
external application finish.
I try various way but is seems the problem is still there.

please any good advice?

thanks a lot

May 3 '07 #2

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

Similar topics

6
by: WhiteRavenEye | last post by:
Why can't I subclass any window except mine in VB? Do I have to write dll for this? I've tried to subclass it with SetWindowLong but without success... Does anyone know how to subclass window...
1
by: Daniel von Fersen | last post by:
Hello, I have a very very big problem. I try to set up a keyboard hook that captures keystrokes from every application, but it seems not to work. I'm using Borland C++, but the SetWindowsHookEx...
1
by: twinfire | last post by:
I have an mfc dialog application that sets a dll as a global keyboard hook. The dll looks for the correct key press, grabs the mouse coords and then sends a message back to the dialog app. I am...
1
by: sharp | last post by:
I have the code below to convert Virtual Keys using the Keyboard state. The problem is that it seems that GetKeyboardState is not working properly. The state comes back the same each time. For...
7
by: jpierson | last post by:
Hi, I am tryin to create a keyboard hook that sends the keystroke ctrl + pause/break. I haven't used keyboard hooks before so I'm not too sure how to use them public int MyKeyboardProc(int...
5
by: neilphan | last post by:
Hi all, I have an application that uses input from a barcode reader via a USB port. My application works fine only if the application HAS FOCUS. If the user opens up another application (not...
3
by: squeak | last post by:
Hi there, I'm new to VB2005 so its probably a very simple answer too! But i just can't think how to do it... Basically i need to detect mouse (and preferably keyboard) movement and kepresses...
7
by: bz | last post by:
Hi, I need an app to run in kiosk mode, so user will not have access to start menu and taskbar while the app is running I was able to hide / show the taskbar with trhe following code when...
2
by: Swan | last post by:
How can I restrict alt+tab and start menu from keyboard while program executing(VB)?I am posting what I tried-- form.frm Option Explicit Private Sub Form_Load() HookKeyboard End Sub...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.