| View previous topic :: View next topic |
| Author |
Message |
DevilGilad Grandmaster Cheater
Reputation: 0
Joined: 10 May 2007 Posts: 624 Location: Delete C:\WINDOWS folder and you'll be able to see me.
|
Posted: Tue Jul 10, 2007 6:14 am Post subject: [Question] Killing other programs when they're running? |
|
|
Can it be?
I want to create a little program that will kill the add when I'm closing MapleStory. How can I do that?
Thx.
_________________
|
|
| Back to top |
|
 |
compactwater I post too much
Reputation: 8
Joined: 02 Aug 2006 Posts: 3923
|
Posted: Tue Jul 10, 2007 6:31 am Post subject: |
|
|
| FindWindow & Send/PostMessage.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Tue Jul 10, 2007 12:18 pm Post subject: |
|
|
| compactwater wrote: | | FindWindow & Send/PostMessage. |
Or kill the prcoess
KillTask('processname');
const
processname = notepad.exe
|
|
| Back to top |
|
 |
DevilGilad Grandmaster Cheater
Reputation: 0
Joined: 10 May 2007 Posts: 624 Location: Delete C:\WINDOWS folder and you'll be able to see me.
|
Posted: Tue Jul 10, 2007 12:21 pm Post subject: |
|
|
| Kaspersky wrote: | | compactwater wrote: | | FindWindow & Send/PostMessage. |
Or kill the prcoess
KillTask('processname');
const
processname = notepad.exe |
I've saw in Torry's Delphi Pages a REALLY long long code. Will your code work? :/
_________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Tue Jul 10, 2007 12:27 pm Post subject: |
|
|
| DevilGilad wrote: | | Kaspersky wrote: | | compactwater wrote: | | FindWindow & Send/PostMessage. |
Or kill the prcoess
KillTask('processname');
const
processname = notepad.exe |
I've saw in Torry's Delphi Pages a REALLY long long code. Will your code work? :/ |
You need to take this function (Taken from Torrys Delphi Pages)
| Code: |
function KillTask(ExeFileName: string): Integer;
const
PROCESS_TERMINATE = $0001;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
Result := 0;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
Result := Integer(TerminateProcess(
OpenProcess(PROCESS_TERMINATE,
BOOL(0),
FProcessEntry32.th32ProcessID),
0));
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
|
then in a button,add KillTask
and yo add Tlhelp32 to the uses list
|
|
| Back to top |
|
 |
|