Aktonius Posted July 15, 2011 Share Posted July 15, 2011 (edited) Basically i make mousestruct in the hook which is in dll MOUSEHOOKSTRUCT* str; THen make it from lparam, LRESULT CALLBACK MouseProc( int nCode, WPARAM wParam, LPARAM lParam ) { str = (MOUSEHOOKSTRUCT *) lParam; ... Then i catch mousemovements case WM_MOUSEMOVE: wParm = AU3_WM_MOUSEMOVE; fromp = WindowFromPoint(str->pt); Then validate and try not to send to many messages... if (fromp != currentwindow) { currentwindow= fromp; PostMessage(m_hHwndMouse, wParm,(WPARAM)( (MOUSEHOOKSTRUCT*) lParam )->hwnd, LPARAM(fromp)); } break; This sends the mousemove message along with hwnd to my autoit app which inspects hwnd and if that hwnd is not active it activates it. Func mouse_func($hWndGUI, $MsgID, $wParam, $lParam) Select Case $MsgID = $WM_AUTOITMOUSEMOVE If GUICtrlRead($activateundermouse) = 1 And $sitting = 0 Then ;Local $starttime = _Timer_Init() If StringInStr(WinGetTitle($lParam), "ID=") Then If Not WinActive($lParam) Then ;ConsoleWrite("HOVERING NEW, Activate It: " & WinGetTitle($lParam) & @LF) WinActivate($lParam) EndIf ;ConsoleWrite("diff is > " & _Timer_Diff($starttime) & @LF) EndIf EndIf This is how i am activating window that is hovered by the mouse but the problem is that rarely autoit wont read the message that should signal new window being hovered(or the dll with hook didnt send it, i dont know) Also if the window is overlapping another window and both of them are valid windows that should be activate once hovered i get flickering as autoit is constantly trying to activate the current window and the overlapped one, in a loop Is there something that perhaps i missed or could be doing wrong here? Also i am using Opt("WinWaitDelay", 100) Edited July 15, 2011 by Aktonius Link to comment Share on other sites More sharing options...
Valik Posted July 15, 2011 Share Posted July 15, 2011 This can be done without a DLL and in pure AutoIt using polling. It would simplify things considerably. Link to comment Share on other sites More sharing options...
Aktonius Posted July 16, 2011 Author Share Posted July 16, 2011 (edited) nevermind... i fixed it trough managing activation in dll Edited July 16, 2011 by Aktonius Link to comment Share on other sites More sharing options...
jvanegmond Posted July 16, 2011 Share Posted July 16, 2011 Same as http://stackoverflow.com/questions/6713747/activate-windows-under-mouse-through-mouse-hook github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now