| View previous topic :: View next topic |
| Author |
Message |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Aug 15, 2008 8:31 pm Post subject: pID vb.net |
|
|
How would I get the pID of an external address in vb.net? I tried searching it but then it came up with this thing like this
| Code: |
Dim instance As Process
Dim value As Integer
value = instance.Id
|
but the ".id" part isn't part of an array or something.
Thanks!
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Aug 15, 2008 10:14 pm Post subject: |
|
|
| Code: | Dim p As Process() = Process.GetProcessesByName("notepad")
p(0).Id |
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Aug 15, 2008 10:44 pm Post subject: |
|
|
i got this as an error on the p(0).Id
Error 2 Identifier expected
yea.
any ideas?
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Aug 15, 2008 10:55 pm Post subject: |
|
|
| paste your code.
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Aug 15, 2008 11:15 pm Post subject: |
|
|
well it doesn't really matter but here:
| Code: |
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
'you part's here
Dim p As Process() = Process.GetProcessesByName("notepad")
p(0).Id
'end of it
Dim myProcess As Process() = Process.GetProcessesByName("winmine")
If myProcess.Length = 0 Then
Exit Sub
End If
myProcess.
Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcess(0).Id)
If processHandle = IntPtr.Zero Then
Exit Sub
End If
End Sub
|
I already have it hooked, but I want the pID. Thanks
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Aug 16, 2008 12:22 am Post subject: |
|
|
| You don't need to use OpenProcess, you get can the handle from your process array as well.
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Sat Aug 16, 2008 2:16 am Post subject: |
|
|
wait, what? Umm... I got confused x]
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Aug 16, 2008 2:58 am Post subject: |
|
|
| hacksign23 wrote: | well it doesn't really matter but here:
| Code: |
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
'you part's here
Dim p As Process() = Process.GetProcessesByName("notepad")
p(0).Id
'end of it
Dim myProcess As Process() = Process.GetProcessesByName("winmine")
If myProcess.Length = 0 Then
Exit Sub
End If
myProcess.
Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcess(0).Id)
If processHandle = IntPtr.Zero Then
Exit Sub
End If
End Sub
|
I already have it hooked, but I want the pID. Thanks |
You were already well on your way before I posted. You just need to take a good look at the Process class.
Basically, just remove what I posted. I didn't know what you had so far.
myProcess(0).Id IS the process ID of minesweeper.
However, look at the other methods, and you will find that you don't need to use OpenProcess, as the Process class also takes care of that for you.
myProcess(0).Handle will yield a valid handle for you to Read / Write / do whatever you want.
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Sat Aug 16, 2008 12:52 pm Post subject: |
|
|
so then I did that, but I got this error
| Code: |
Error 1 Property access must assign to the property or use its value. 609 9
|
_________________
|
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Sat Aug 16, 2008 3:34 pm Post subject: |
|
|
p(0).Id
must have a assignment
like
Msgbox p(0).Id
or assuming Id is a int
Public MyPID as integer
MyPID = p(0).Id
Msgbox MyPID
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Sat Aug 16, 2008 10:33 pm Post subject: |
|
|
Okay, assume i do this
| Code: |
Dim myProcess As Process() = Process.GetProcessesByName("winmine")
If myProcess.Length = 0 Then
Exit Sub
End If
myProcess.ID
Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcess(0).Id)
If processHandle = IntPtr.Zero Then
Exit Sub
End If
|
MyPID would be a process in your post, not an int.
For mine, if i did myProcess.ID, then it would show up as an error as
| Quote: |
Property access must assign to the property or use its value.
|
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Aug 16, 2008 10:48 pm Post subject: |
|
|
| hacksign23 wrote: | Okay, assume i do this
| Code: |
Dim myProcess As Process() = Process.GetProcessesByName("winmine")
If myProcess.Length = 0 Then
Exit Sub
End If
myProcess.ID
Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcess(0).Id)
If processHandle = IntPtr.Zero Then
Exit Sub
End If
|
MyPID would be a process in your post, not an int.
For mine, if i did myProcess.ID, then it would show up as an error as
| Quote: |
Property access must assign to the property or use its value.
|
|
What the hell are you doing? Are you even reading the responses?
myProcess(0).Id is the process ID, yes. So why are you just randomly putting it in the middle of your code? It's becoming increasing obvious that you just copy and pasted some code with no idea what you're doing.
You're not doing anything with myProcess(0).Id other than just randomly placing it.
| Code: | Dim i As Integer = 0
i = myProcess(0).Id |
And once again, you don't need OpenProcess. You already have the handle.
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Mon Aug 18, 2008 1:45 pm Post subject: |
|
|
OH WAIT WTF LOL IT WORKS NOW. THANKS PEOPLE!
i think it was because i forgot to do the
bla = myProcess(0).ID whatever lol
_________________
|
|
| Back to top |
|
 |
|