| View previous topic :: View next topic |
| Author |
Message |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Thu Nov 08, 2007 2:27 am Post subject: Auto Attach ? |
|
|
if i whant my program auto attach process name "Sro_Client" how sould i write then?
well i know this thing down here dosent work but it shows what i mean
if listbox1.items = 'Sro_Client.exe' then
OpenProcess ('Sro_Client.exe');
i tryed to search at google cant find anything
the script on this site is for "process watcher" and dosent work for normal process list
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Thu Nov 08, 2007 2:37 am Post subject: |
|
|
| Create a timer or a thread, and try getting the process ID in it. When it succeed, open the process.
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Thu Nov 08, 2007 2:40 am Post subject: |
|
|
| assaf84 wrote: | | Create a timer or a thread, and try getting the process ID in it. When it succeed, open the process. |
thats not the problem the problem is how should the code look like that detect if "Sro_Client.exe" exist in the listbox (thats a noobie question but id remember how to find strings in list boxes)
and how should the
OpenProcess ('Sro_Client.exe'); look like
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Thu Nov 08, 2007 4:51 am Post subject: |
|
|
| Search OpenProcess in MSDN, and search ListBox in www.delphibasics.co.uk
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Nov 08, 2007 8:09 am Post subject: |
|
|
Looks like you are coding this in VB, heres a quick example I tossed together on how to check if the process is found.
EDIT::
As for OpenProcess, you need to set it up like this (using the source attached to this post, the API and constants are there already) you would need to, first ensure you are attached and have a valid process id, to do that just make sure CheckForProc returns true, and that dwProcId <> 0.
Next, make a function to do what you want and have OpenProcess setup like:
| Code: | Private Function Attach()
Dim pHandle As Long
If CheckForProc("winmine.exe") = False Then Exit Function
If dwProcId = 0 Then Exit Function
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, dwProcId)
'// Your Code Here
CloseHandle pHandle
End Function |
_________________
- Retired. |
|
| Back to top |
|
 |
|