Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB.NET] same process name

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
leejoonwhan
How do I cheat?
Reputation: 0

Joined: 17 Jan 2016
Posts: 2

PostPosted: Sun Jan 17, 2016 11:55 am    Post subject: [VB.NET] same process name Reply with quote

Hello.

I successed to make trainer by vb.net 2015.

But there is a problem.

When running more than two of same application and so exist same process name,
it isn't run at client which i want, but at random client because trainer calls process every button.

How can i run trainer at client which i first started?

I tried WriteInteger(PID, &HAAAAAA, TextBox5. Text) -> but occured error.

This is the code i made.



Private Sub Button1_Click(sender As Object, e As EventArgs)
WriteInteger("notepad", &HAAAAAA, TextBox1.Text)
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs)
WriteInteger("notepad", &HBBBBBB, TextBox2.Text)
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs)
WriteInteger("notepad", &HCCCCCC, TextBox3.Text)
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs)
WriteInteger("notepad", &HDDDDDD, TextBox4.Text)
End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs)
WriteInteger("notepad", &HEEEEEE, TextBox5.Text)
End Sub
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Jan 17, 2016 12:27 pm    Post subject: Reply with quote

The Process class exposes GetProcessesByName that would be what you want to use:
https://msdn.microsoft.com/en-us/library/z3w4xdc9(v=vs.110).aspx

This will return an array of the processes that match the name you give. That said, you can loop through them to find the earliest launched process by using the StartTime property of each process.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
leejoonwhan
How do I cheat?
Reputation: 0

Joined: 17 Jan 2016
Posts: 2

PostPosted: Tue Jan 19, 2016 8:12 pm    Post subject: thank you Reply with quote

Thank you for your advice. Very Happy

I succes to get PID by GetProcessesByname as you said, but error occured when i use PID at WriteInteger.

Excuse me, can you tell me the using method?

This is the code I made.


*************************************************************

Public Class Form1
Dim PID

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim PID As Integer
For Each Proc As Process In Process.GetProcessesByName("game")
PID = Proc.Id
TextBox5.Text = PID
End Sub


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WriteInteger(PID, &HBE1958, TextBox5.Text) →→→→→→→→→→→→→→→→ PID Error!!
End Sub
Back to top
View user's profile Send private message
VirtualMind
Newbie cheater
Reputation: 0

Joined: 04 Apr 2015
Posts: 20

PostPosted: Tue Apr 19, 2016 5:00 pm    Post subject: Re: thank you Reply with quote

leejoonwhan wrote:
Thank you for your advice. Very Happy

I succes to get PID by GetProcessesByname as you said, but error occured when i use PID at WriteInteger.

Excuse me, can you tell me the using method?

This is the code I made.


*************************************************************

Public Class Form1
Dim PID

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim PID As Integer
For Each Proc As Process In Process.GetProcessesByName("game")
PID = Proc.Id
TextBox5.Text = PID
End Sub


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WriteInteger(PID, &HBE1958, TextBox5.Text) →→→→→→→→→→→→→→→→ PID Error!!
End Sub


did you even read what atom said?
get the earliest launched process by using the StartTime property.

haven't done VB for a while but this should do it
Code:
     Dim p As Process() = Process.GetProcessesByName("the names of the processes")
        For i As Integer = 0 To p.Length
            If p(i).StartTime > p(i + 1).StartTime Then
                MsgBox("blaBla")
            Else
                MsgBox("blaBla")



on a second note. why are you declaring 'PID' twice ? that might be the error to begin with
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites