Vidyadhar,

I didn't respond earlier as I was pretty busy at work and this is a rather
detailed request.  In addition this is, in my mind, not really Perl related.
That said, I'm stuck home under a few feet of snow tonight and can spend
some time on this for you.

The basic problem is that the two processes are owned by different
primaries.  In order to do what you want to do, my first thought is to
impersonate the user's credentials.  The big problem there is that you
probably don't have the user's password.  My next thought is that since you
seem to be targeting a specific application, it may be easier to look at the
process list, rather than the windows on the desktop.  Let's take a stab at
this approach... (opening Komodo)...

----------8<----------CODE---------->8----------
#!perl.exe
use strict;
use warnings;

# Included Modules
use Win32::Process;
use Win32::ToolHelp;

# Locate window by executable name
my $pID    = 0;
my $iFlags = 0;
my $pname  = "notepad.exe";

my( @Process ) = Win32::ToolHelp::SearchProcess($pname);
unless( Win32::Process::Open( $pID, $Process[1], $iFlags )) {
    print "Win32::Process::Open => ".
          Win32::FormatMessage(Win32::GetLastError())."\n";
}

# Kill identified process
my $uExitCode = 0;

$pID->Kill( $uExitCode );

__END__
----------8<----------CODE---------->8----------

I compiled the above with PerlApp and then scheduled it with an AT command.
It killed the copy of notepad.exe running in my user process.  It does seem
that $pname is case sensitive so be careful when recompiling this for your
target application.  Hope that this helps you out...

Chris
> -----Original Message-----
> From: Jangale V-S [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 17, 2003 11:09 PM
> To: [EMAIL PROTECTED];
> [EMAIL PROTECTED]
> Subject: FW: killing a process by window title; was: socket 
> application
> 
> 
> Somebody help please !!
> 
> -----Original Message-----
> From: Jangale V-S 
> Sent: 13 February 2003 11:06
> To: [EMAIL PROTECTED];
> [EMAIL PROTECTED]
> Subject: RE: killing a process by window title; was: socket 
> application
> 
> 
> Further to this topic I have a slightly different requirement.
> 
> I want to kill process running on interactive desktop (with 
> interactive
> user's login) through scheduler .
> 
> The background is 
> 
> User logged on interactively on a machine are running one application
> which they sometimes leave ON overnight . 
> 
> A process is running thr schduler (using different user 
> account which is
> administrator account) which has to update certain files 
> related to above
> application. For this the applcation has to be terminated/closed after
> verifying
> window title !
> 
> Now how can I get/enumerate windows which are open in 
> interactive user's
> desktop ?
> 
> 
> With Best Regards,
> 
> Vidyadhar
> 
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. 
It is intended for the addressee(s) only. Access to this E-mail by anyone else is 
unauthorized. If you are not an addressee, any disclosure or copying of the contents 
of this E-mail or any action taken (or not taken) in reliance on it is unauthorized 
and may be unlawful. If you are not an addressee, please inform the sender immediately.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to