RE: winapi: mouseclick

Discussion in 'Python' started by Tim Golden, Jan 27, 2004.

  1. Tim Golden

    Tim Golden Guest

    >-----Original Message-----
    >From: KNS [mailto:]
    >Sent: 27 January 2004 08:19
    >To:
    >Subject: Re: winapi: mouseclick
    >
    >
    >
    >Just to add some clarification, this is in fact a Python question.
    >I'm just working within the Windows environment. And, now that
    >I'm here, I'm certain this is child's play for many of you, so
    >a bit of help would be most welcomed.
    >
    >Thanks.
    >
    >KNS wrote:
    >>
    >> Hello,
    >>
    >> Can someone please suggest how to test for a mouse click using
    >> the WinAPI? I have dispatched a windows application and would
    >> like to detect any mouseclicks (and keyboard entry for that

    >matter)...
    >>
    >> Thanks.
    >>

    >


    <sigh>
    Your question is not the most precise one I've ever seen. If
    you have written a Windows app then you presumably understand
    how the Windows messaging setup works. In which case, what
    you need to do is to handle WM_LBUTTONDOWN and related messages.

    If you're not sure which messages to go for, look at this:

    http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/use
    rinput.asp

    which gives an overview.

    There's an example of doing this kind of thing in Python
    using the ctypes modules:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/208699

    You can also do it with the win32all extensions from Mark
    Hammonds pages:

    http://starship.python.net/crew/mhammond/win32/Downloads.html

    If this isn't really what you were asking, could you post a
    segment of code showing what you're about and where you're
    stuck?

    TJG


    ________________________________________________________________________
    This e-mail has been scanned for all viruses by Star Internet. The
    service is powered by MessageLabs. For more information on a proactive
    anti-virus service working around the clock, around the globe, visit:
    http://www.star.net.uk
    ________________________________________________________________________
     
    Tim Golden, Jan 27, 2004
    #1
    1. Advertising

  2. Tim Golden

    KNS Guest

    Thank you for the response. I am actually using win32all to launch an
    application and am waiting for user actions or changes in state. Once
    the application is launched (e.g., IE) the program just records changes
    in URLs. Now I would like the various states (e.g., time, mouse
    position) saved whenever the mouse is clicked on the application (or
    even the desktop). So, can I just use an 'if' (within a while-loop) to
    test whether WM_LBUTTONDOWN == 0 and if so what is the appropriate
    syntax with win32all?

    Thanks.


    Tim Golden wrote:
    >>-----Original Message-----
    >>From: KNS [mailto:]
    >>Sent: 27 January 2004 08:19
    >>To:
    >>Subject: Re: winapi: mouseclick
    >>
    >>
    >>
    >>Just to add some clarification, this is in fact a Python question.
    >>I'm just working within the Windows environment. And, now that
    >>I'm here, I'm certain this is child's play for many of you, so
    >>a bit of help would be most welcomed.
    >>
    >>Thanks.
    >>
    >>KNS wrote:
    >>
    >>>Hello,
    >>>
    >>>Can someone please suggest how to test for a mouse click using
    >>>the WinAPI? I have dispatched a windows application and would
    >>>like to detect any mouseclicks (and keyboard entry for that

    >>
    >>matter)...
    >>
    >>>Thanks.
    >>>

    >>

    >
    > <sigh>
    > Your question is not the most precise one I've ever seen. If
    > you have written a Windows app then you presumably understand
    > how the Windows messaging setup works. In which case, what
    > you need to do is to handle WM_LBUTTONDOWN and related messages.
    >
    > If you're not sure which messages to go for, look at this:
    >
    > http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/use
    > rinput.asp
    >
    > which gives an overview.
    >
    > There's an example of doing this kind of thing in Python
    > using the ctypes modules:
    >
    > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/208699
    >
    > You can also do it with the win32all extensions from Mark
    > Hammonds pages:
    >
    > http://starship.python.net/crew/mhammond/win32/Downloads.html
    >
    > If this isn't really what you were asking, could you post a
    > segment of code showing what you're about and where you're
    > stuck?
    >
    > TJG
    >
    >
    > ________________________________________________________________________
    > This e-mail has been scanned for all viruses by Star Internet. The
    > service is powered by MessageLabs. For more information on a proactive
    > anti-virus service working around the clock, around the globe, visit:
    > http://www.star.net.uk
    > ________________________________________________________________________
    >
     
    KNS, Jan 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. watzlaw wutz
    Replies:
    2
    Views:
    809
    Pasturel
    May 11, 2004
  2. KNS

    winapi: mouseclick

    KNS, Jan 26, 2004, in forum: Python
    Replies:
    1
    Views:
    393
  3. Tim Golden

    RE: winapi: mouseclick

    Tim Golden, Jan 27, 2004, in forum: Python
    Replies:
    0
    Views:
    390
    Tim Golden
    Jan 27, 2004
  4. Tim Golden

    RE: winapi: mouseclick

    Tim Golden, Jan 27, 2004, in forum: Python
    Replies:
    4
    Views:
    1,649
    Barry Drake
    Feb 10, 2004
  5. tw
    Replies:
    3
    Views:
    562
Loading...

Share This Page