You use the Process class. The Process class is used for starting, stopping, controlling, and monitoring applications. Using the Process component, you can obtain a list of the processes that are running or start a new process. To get the keypress, you trap the KeyDown event and check if Ctrl+F1 was pressed. One thing you need to remember to do is set the form's KeyPreview to True to trap all keys before your controls receive the keys pressed.
Imports System.Diagnostics
Me.KeyPreview = True
Private Sub Form1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.F1 And e.Control() Then
proc = New Process()
proc.StartInfo.FileName = "c:\MyAccessProgram.exe"
proc.StartInfo.Arguments = "MyNetProgramName"
proc.Start()
End If
End Sub
>Hi all
>
>I want a small program that i made myself become active, when I press ctrl+f1 anywere in windows,. But i can't find anything about it anywhere.
>
>Allso, I want the my small program to know what other program(e.g. Acces2k) has focus when ctrl+f1 is pressed.
>
>Any help at all is appreciated.
>
>Thanks :)
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi