[python-win32] Detect if user has a window opened in full screen mode?

2008-08-21 Thread Patrick Li
Hi,

Is there a way I can detect whether or not the user has any window that is
running in full screen mode? (Playing a game that takes up the entire
screen, or having the browser maximized, etc)

Thanks,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] how to obtain list of connected IP/port pairs on user's computer?

2008-09-07 Thread Patrick Li
Hi,

I'm interested in writing a function that returns me the list of IP/port
that the user's machine is connected to.  The most naive way is to run
netstat -na on the user's computer and just parse the stdout.  Are there
libraries I can call to achieve this as opposed to running an external
command?

Thanks,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] idle detection on system?

2008-09-22 Thread Patrick Li
Hi,
Does anyone know how I can detect if a system is idle?  By idle I am
referring to a user being away from the computer (no keyboard or mouse
movement) for X minutes.  Tried searching around but I haven't found
anything that mentions how I can hook into these two events.

Thanks in advance,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] How to launch an executable in elevated mode on Vista with UAC on?

2009-03-02 Thread Patrick Li
Hello,
I have a python program that needs to launch an executable (it is an
installer executable) that requires admin privileges.  This works fine on XP
and Vista machines where UAC is turned off.  On Vista machines with UAC on,
however, it doesn't appear to allow the program to launch the executable.

I currently use win32process.CreateProcess() to launch the executable.

Does anyone know of a way I can launch the executable with UAC on?  Ideally,
it should prompt the user to run the executable in elevated mode.

Any help would be greatly appreciated.

Thanks,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Detect when the user launches or closes a program?

2007-11-19 Thread Patrick Li
Hi,

I am trying to write a program that will perform some operation on the
user's computer when the user launches a particular executable(s) on the
computer and when the user closes them.

One way to achieve this is by polling the process table periodically and
checking to see if one of the running processes matches the executable name
that I am looking for.  However, I would much prefer not polling so
frequently as it seems to be a waste of user's system resource.

Does anyone know if there is a way to hook a callback to windows where it
will trigger my function when windows launches a particular program?  I
think that would be the ideal thing to do if that is available.

Thanks.
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Detect when the user launches or closes a program?

2007-11-19 Thread Patrick Li
On 11/19/07, bob gailer <[EMAIL PROTECTED]> wrote:
>
> Patrick Li wrote:
> > Hi,
> >
> > I am trying to write a program that will perform some operation on the
> > user's computer when the user launches a particular executable(s) on
> > the computer and when the user closes them.
> >
> > One way to achieve this is by polling the process table periodically
> > and checking to see if one of the running processes matches the
> > executable name that I am looking for.  However, I would much prefer
> > not polling so frequently as it seems to be a waste of user's system
> > resource.
> If you have control over the user's environment give him a .bat file
> that will perform some operation on his computer and launch the
> executable.


Thought about that, too.  Unfortunately  I'll have no control over the
user's environment.  All I will know is the name of the executable file as
well as the path at which it is located.
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] setting my windows service as automatic instead of manual

2007-11-28 Thread Patrick Li
Hi,

I have created a simple windows service using win32serviceutil.  I was able
to use py2exe to turn it into a windows executable successfully.  However, I
cannot figure out how I can get the startup type of this service to
"automatic" instead of "manual".   I understand that I can go through the
control panel to do this manually, but I'd like the service to be shipped
with the automatic start up type instead of manual.

Does anyone know how I can do that?

Thanks,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] How to get command line parameters of running processes via pywin32

2007-12-05 Thread Patrick Li
Hi,

I am interested in scanning the user's process table periodically and
getting the list of running process names as well as their command line
parameters.

For the process names, I am able to get the list of pids using
win32process.EnumProcesses and then use win32api.OpenProcess and
win32process.GetModuleFileNameEx to get the names.  However, I couldn't find
anywhere in the doc that tells me how to get the command line parameters for
them as well.

Then I found the WMI module on
http://tgolden.sc.sabren.com/python/wmi_cookbook.html#running_processes that
seems to do the trick:

import wmi
c = wmi.WMI ()
for process in c.Win32_Process ():
  print process.CommandLine

Is that the most efficient way to get the command line parameters?  My
program will need to scan the process table quite often, so I am trying to
make this operation as lightweight as noticeable.

Thanks,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Check if user has windows administrator privilege

2008-01-14 Thread Patrick Li
Hi,

Does anyone know if there's a way to programmatically check to see if a user
has windows administrator privilege?  I need this to work in WinXP and
Vista.

Thanks in advance,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] win32api.GetShortPathName() leaks memory?

2008-05-17 Thread Patrick Li
Hi,

I'm running into some memory leak issue when running the
win32pi.GetShortPathName function.  Basically I've got a daemon that will
perform this function on lots of long windows path names.  Over time, it
looks like the memory footprint increases substantially.

You can reproduce it by simply launching this in your python interpreter:

import win32api

for x in xrange(100):
  win32api.GetShortPathName("c:\\documents and settings\\some
directory\\name")

You will see in your windows task manager that the memory usage shoots up.

Anyone have any idea on how to get around this problem?  I thought about
writing my own version of GetShortPathName, but so far I haven't been able
to find any source code/docs online on the proper logic to generate the
short name.

Thanks,
Patrick
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32