Re: Invisible processes in Win2K

2007-06-21 Thread Tim Golden
[EMAIL PROTECTED] wrote:
> I'm running a Python program on M$ Windows 2000 as a test monitor. The 
> program 
> should close various processes, mostly "Application error"-windows, as they 
> are 
> created. This works fine until the screensaver gets active or until I press 
> Ctrl-Alt-Del and choose "Lock my computer". At that point, my Python program 
> cannot see any change when a "Application error" pops up. Without locked 
> computer, it can identify these windows and close them, but I want it to do 
> this with the computer locked as well.

I have no chance of checking this out the moment,
but ISTR that when a computer is locked, the
desktop is actually the desktop of a different
(special screensaver) session. Exactly what effect
this will have on your program I'm not sure; it
presumably depends on the interaction between
the session/desktop and the various .Enum
routines.

TJG
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Invisible processes in Win2K

2007-06-21 Thread M�ta-MCI
Hi!

When you lock (the cpu), interactive mode is off.
You can try to use services, who run independently of sessions. But...






-- 
http://mail.python.org/mailman/listinfo/python-list


Invisible processes in Win2K

2007-06-20 Thread henrik.garbergs
Hi!

I'm running a Python program on M$ Windows 2000 as a test monitor. The program 
should close various processes, mostly "Application error"-windows, as they are 
created. This works fine until the screensaver gets active or until I press 
Ctrl-Alt-Del and choose "Lock my computer". At that point, my Python program 
cannot see any change when a "Application error" pops up. Without locked 
computer, it can identify these windows and close them, but I want it to do 
this with the computer locked as well. (My company has a policy that says you 
have to lock the computer or activate a password protected screensaver when you 
leave your desk)

The code I'm using to list processes looks like this:

# 
def process_callback_function(hwnd, resultdict):
# Callback-function for win32gui.EnumWindows
wtext = win32gui.GetWindowText(hwnd)
if wtext != '' and wtext != 'Default IME':
resultdict.update( {wtext:hwnd} )
# 
def getProcessDictionary(w):
try:
win32gui.EnumWindows(process_callback_function, w)
except Exception, message:
logAndPrint('Error in getProcessDictionary: ' + str(message))
# 
def getProcessList():
# Flush old cache
win32pdh.EnumObjects(None, None, 0, 1)
# Get a list of processes running on the system:
try:
junk, instances = win32pdh.EnumObjectItems(None,None,'Process', 
win32pdh.PERF_DETAIL_WIZARD)
except win32api.error, message:
logAndPrint('Error in getProcessList(): ' + str(message))
return []
else:
return instances
# 

# Code in main loop:
topWindows = {}  
getProcessDictionary(topWindows)
for w in topWindows.iteritems():
...if 'Application Error' in w[0]:
...closeProcess(w[1])


I'm using two functions to receive process info: getProcessList and 
getProcessDictionary. I have tried to save the result of these, compare them at 
different times in the main loop and print newly started processes. This works 
great outside "locked computer"-mode where it prints all new processes found, 
including Application errors. But when the computer is locked and Application 
errors pops up, the Python program shows no new processes. It's not hanged or 
freezed, since it can identify the screensaver and also keep doing other work. 
So what is so special about the error windows?

Any help with this is greatly appreciated!

Best regards,
/Henrik

-- 
http://mail.python.org/mailman/listinfo/python-list