Attaching to a Process?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

iLee

Thread Starter
Joined
Jan 21, 2009
Messages
52
Could anybody help me on this predicament? I need to attach my program to a process named 'gunbound.gme' So I can use the 'SendKeys.Send(TextBox1.Text)'

Any help is appreciated.

I'm using Visual Basics 2010.
 
Joined
Jul 28, 2008
Messages
1,899
The SendKeys function will send the keys you specify to the active window, so if gunbound.gme has focus then the keys will be sent to that application. This means that you do not have to attach your program to it's process, rather ensure that it runs when gunbound.gme has focus.
 

iLee

Thread Starter
Joined
Jan 21, 2009
Messages
52
But in doing so, when I switch to gunbound.gme, none of the SendKeys work once switching to that process, however if I switch out, it'll work.
 
Joined
Jul 28, 2008
Messages
1,899
When you switch to the gunbound.gme process, the program you have created will continue to run, so it is still capable of sending the keys you want to. Do you have any code so far ?
 

iLee

Thread Starter
Joined
Jan 21, 2009
Messages
52
PHP:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        AutoType.Interval = (TextBox4.Text)
        AutoType.Enabled = True
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        AutoType.Enabled = False
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        MessageBox.Show("Type what you want to say in the TextBoxes, and tick the Checkboxes that you want to say. Then click start and open your Application, I am currently working on Hotkeys, to enabled while using an Application. Click Start and Stop for obvious reasons.")
    End Sub

    Private Sub AutoType_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AutoType.Tick
        If CheckBox1.Checked = True Then
            SendKeys.Send(TextBox1.Text)
            SendKeys.Send("{Enter}")
        End If
        If CheckBox2.Checked = True Then
            SendKeys.Send(TextBox2.Text)
            SendKeys.Send("{Enter}")
        End If
        If CheckBox3.Checked Then
            SendKeys.Send(TextBox3.Text)
            SendKeys.Send("{Enter}")
        End If
    End Sub
End Class
Well, the code works fine, as I've tried it. But whenever I switch to Gunbound.gme it continues in another process, because for some reason it doesn't fully switch to it. Which Is why I need to attach it to the process.
 
Joined
Jul 28, 2008
Messages
1,899
If the code works fine and sends the key as expected, what do you mean by it doesn't fully switch to it ? Here is the MSDN documentation for the SendKeys.SendWait() method, the first note should help with targeting the correct window.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top