Windows API

Neil Hodgson neilh at scintilla.org
Mon Jul 10 07:02:33 EDT 2000


> I am very new to Python and I am waiting for my first
> book. I would like to ask you how to use Windows API
> in Python?. With an example please.

   You should grab Mark Hammond's Win32 extensions from
http://starship.python.net/crew/mhammond/
    which includes the Pythonwin development environment.

    For an example, start Pythonwin, and you should an Interactive Window.
Into that window type (just the bit after ">>>"):
>>> import win32api
    this loads definitions of the core Windows API.
    Then call an API with
>>> win32api.Beep(3000,300)
    As you press the "." a list of the available calls should appear. You
can continue typing or select an item and press Tab to enter that item.
    Pressing enter after this typing will execute the code and produce a
noise - hope you have a sound card.

    The online help lists all of the APIs wrapped by the Win32 extensions
which includes a good proportion of the entire Win32 API. For complete
descriptions of each API, you will want access to MSDN, either online at
http://msdn.microsoft.com or by downloading the Platform SDK from the same
site. There is a book by Mark and Andy called "Python Programming on Win32"
which contains a lot of pages and a decent cover illustration.

   Neil





More information about the Python-list mailing list