Modifying the system menu

raj.indian.08 at gmail.com raj.indian.08 at gmail.com
Tue Sep 16 23:31:54 EDT 2008


Hi all,
    I am trying to modify the system menu of all the applications in
my machine.
    For example say - I am creating multiple desktops for windows  -
and I want to give every application the capability to be moved across
different desktops. So I wanted to modify the basic system menu list
to include the new options.

    The methods I could think of are -
1. Modify the basic windows set of system menu values (best option)
       or
2. Poll every few milliseconds and modify the system menu values of
the active window

For (1) I couldnt think of a way to do it. Is it even possible using
python?

For (2) I wrote the following code for basic testing:
    hwnd = win32gui.GetForegroundWindow()
    hw = win32gui.GetSystemMenu(hwnd, False)
    if hw != None:
        win32gui.AppendMenu(hw,win32con.MF_SEPARATOR,0,'-');

and it shows the following error: pywintypes.error: (1401,
'AppendMenu', 'Invalid menu handle.')

If anyone could help me out in both the options (1) and/or (2), I
would be very thankful.

Thank you very much in advance,
A python newbie



More information about the Python-list mailing list