Capturing window drug and resize

If you have a question or need help, this is the place to be.

Capturing window drug and resize

Postby TMSxEventGhost » Fri Sep 30, 2016 10:11 am

I need to capture when windows got resized or drugged (I want to lay them together in a particular way), however, to do this we need to use winApi like SetWinEventHook.

Fortunately those api are ported to python by PyHook and already used by mouse event plugin http://www.eventghost.net/forum/viewtopic.php?f=9&t=3720.

We need for example to listen to Windows messages to get resizing event, as explained here http://stackoverflow.com/questions/2880160/listening-to-another-window-resize-events-in-c-sharp.

I tired to incorporate this in my own plugin but because my knowledge in python is shallow I get like ton of errors related to threading:

Code: Select all
..\EventGhost\eg\Classes\ThreadWorker.py:319: Runtime Warning: tp_compare didn't return -1 or -2 for exception
  if resultCode == WAIT_OBJECT_0:
Traceback (most recent call last) (1722):
  File "..\EventGhost\eg\Classes\ThreadWorker.py", line 319, in __DoOneEvent
    if resultCode == WAIT_OBJECT_0:
TypeError: an integer is required
Exception in thread ActionThread:
Traceback (most recent call last):
  File "threading.pyc", line 532, in __bootstrap_inner
  File "threading.pyc", line 484, in run


This is a brief of what I did in the plugin:

Code: Select all
import pyHook
import cpyHook
import HookManager

class Test(eg.ActionBase):
    def __call__(self):
        print "dose nothing"

    def Hok(self):
        hc=HookManager.HookConstants()
        cpyHook.cSetHook(hc.WH_MOUSE_LL, self.Res)

    def Res(self, msg, x, y, data, flags, time, hwnd, window_name):
        print "working"



Where latter on i will listen to 'WH_CALLWNDPROC' message for resizing events as mentioned in the url above.

Any help is appreciated how to incorporate this stuff, since my knowledge here is limited.

P.S
I just put all PyHook files in the same folder of the plugin, otherwise it will not "see" cpyHook.
TMSxEventGhost
 
Posts: 6
Joined: Thu Sep 29, 2016 11:17 am

Return to General Support

Who is online

Users browsing this forum: Bing [Bot] and 5 guests