Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

How do I control other apps with my app?

I am writing an app for a disabled friend. The app displays a form with four buttons. These buttons are meant to act like pressing the arrow keys on the keyboard. The idea being that my friend can use the mouse to click the buttons instead of having to press the arrows on the keybaord.

The problem I have is how do I allow my app to control another app. My app would have to stay active while other apps are running.

I'm using VB5 and I do not know if this is even possible.

Any help would be great. thanks.

 
0
coles01
Asked:
coles01
1 Solution
 
DalinCommented:
coles01,
This will keep your app stay active:
1. In the general declaration area of your form (form1), add:
              Private Declare Function GetForegroundWindow Lib "user32" () As Long

2. drop a timer to your form, set the interval to 50 (you can adjust this).

3. in the timer1_timer event, add:

     If GetForegroundWindow()<>me.hwnd then  me.show

 This will grap the focus back every 50 milliseconds

Let me know if you have questions
Regards
Dalin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now