Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3670
Number of posts: 9122

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Close Posted by Margalo on 13 Nov 2005 at 9:24 AM
I want to write a batch program for my windows xp computer, that does the following:

1) It activates itself whenever a specified program is run.

2) It closes a program if the program is running.

Now if #1 is impossible, then it is not nessesary but I need to be able to do #2. for example, I want the program to close solitare if I am playing solitare.



I remain gentelmen you obedeiant servant
-OG[/purple]
[/italic][/red]
-Margalo
Report
Re: Close Posted by AsmGuru62 on 13 Nov 2005 at 11:32 AM
: I want to write a batch program for my windows xp computer, that does the following:
:
: 1) It activates itself whenever a specified program is run.
:
: 2) It closes a program if the program is running.
:
: Now if #1 is impossible, then it is not nessesary but I need to be able to do #2. for example, I want the program to close solitare if I am playing solitare.
:
:

: I remain gentelmen you obedeiant servant
: -OG[/purple]
:
[/italic][/red]
: -Margalo
:
You can run a program with a timer and tell it to scan the running applications every 20 sec and then kill some if you detect them. Of course, the reaction will not be instant, but still...

Report
Re: Close Posted by Margalo on 15 Nov 2005 at 1:43 PM
: : I want to write a batch program for my windows xp computer, that does the following:
: :
: : 1) It activates itself whenever a specified program is run.
: :
: : 2) It closes a program if the program is running.
: :
: : Now if #1 is impossible, then it is not nessesary but I need to be able to do #2. for example, I want the program to close solitare if I am playing solitare.
: :
: :

: : I remain gentelmen you obedeiant servant
: : -OG[/purple]
: :
[/italic][/red]
: : -Margalo
: :
: You can run a program with a timer and tell it to scan the running applications every 20 sec and then kill some if you detect them. Of course, the reaction will not be instant, but still...
:
:
That option does sound apealing, but I will not pretend to be a master of the batch arts... I never knew it was possible to scan running aplications, and do you use the "kill" command, to kill the programs? if you do would using "kill" delete the program, or just stop it from running?


I remain gentelmen you obedeiant servant
-OG[/purple]
[/italic]

-Margalo

Report
Re: Close Posted by AsmGuru62 on 16 Nov 2005 at 5:41 AM
: : : I want to write a batch program for my windows xp computer, that does the following:
: : :
: : : 1) It activates itself whenever a specified program is run.
: : :
: : : 2) It closes a program if the program is running.
: : :
: : : Now if #1 is impossible, then it is not nessesary but I need to be able to do #2. for example, I want the program to close solitare if I am playing solitare.
: : :
: : :

: : : I remain gentelmen you obedeiant servant
: : : -OG[/purple]
: : :
[/italic][/red]
: : : -Margalo
: : :
: : You can run a program with a timer and tell it to scan the running applications every 20 sec and then kill some if you detect them. Of course, the reaction will not be instant, but still...
: :
: :
: That option does sound apealing, but I will not pretend to be a master of the batch arts... I never knew it was possible to scan running aplications, and do you use the "kill" command, to kill the programs? if you do would using "kill" delete the program, or just stop it from running?
:

: I remain gentelmen you obedeiant servant
: -OG[/purple]
:
[/italic]

: -Margalo
:
:
If you need a tool yo do that - try to search the Web, maybe there are some... If you want to write it yourself - you need to use Win32 API:

EnumWindows() - scans running processes (or some of it)
TerminateProcess () - kills running program

Report
Re: Close Posted by Margalo on 16 Nov 2005 at 7:44 AM
: : : : I want to write a batch program for my windows xp computer, that does the following:
: : : :
: : : : 1) It activates itself whenever a specified program is run.
: : : :
: : : : 2) It closes a program if the program is running.
: : : :
: : : : Now if #1 is impossible, then it is not nessesary but I need to be able to do #2. for example, I want the program to close solitare if I am playing solitare.
: : : :
: : : :

: : : : I remain gentelmen you obedeiant servant
: : : : -OG[/purple]
: : : :
[/italic][/red]
: : : : -Margalo
: : : :
: : : You can run a program with a timer and tell it to scan the running applications every 20 sec and then kill some if you detect them. Of course, the reaction will not be instant, but still...
: : :
: : :
: : That option does sound apealing, but I will not pretend to be a master of the batch arts... I never knew it was possible to scan running aplications, and do you use the "kill" command, to kill the programs? if you do would using "kill" delete the program, or just stop it from running?
: :

: : I remain gentelmen you obedeiant servant
: : -OG[/purple]
: :
[/italic]

: : -Margalo
: :
: :
: If you need a tool yo do that - try to search the Web, maybe there are some... If you want to write it yourself - you need to use Win32 API:
:
: EnumWindows() - scans running processes (or some of it)
: TerminateProcess () - kills running program

:
I thank thee! this has proved to be very usfull, If anything goes wrong i'll ask. Thanks again!

-Margalo



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.