sss123next
7th April 2013 21:38 UTC
problem with system plugin
Hi all, i am trying to get "window" under current cursor position, i found working example which work as i need, it using WindowFromPoint api function, but does not work for disabled windows, i read in msdn what i need another api function to get handle of disabled window ChildWindowFromPointEx, but it does not work for me, code follows:
Function OnTimer
${Unless} $tips <> 0
System::Call USER32::CreateWindowEx(i0x00000008,t"tooltips_class32",i,i0x80000000,i,i,i,i,i,i,i0,i)i.s
Pop $tipS
${EndUnless}
System::Alloc 16
Pop $0
System::Call USER32::GetCursorPos(ir0)
System::Call *$0(i.r1,i.r2)
System::Free $0
System::Call USER32::ChildWindowFromPointEx(i $HWNDPARENT, ir1, ir2, i 0)i.R7 #should work, but not working at all
;System::Call USER32::WindowFromPoint(ir1,ir2)i.R7 #working, but not for disabled windows
${If} $R7 == $our_btn
StrCpy $R1 "test"
System::Call *(i0x28,i0x010,i$our_btn,i0x409,i,i,i,i,i0,tR1)i.R1
SendMessage $tipS 1028 0 $R1
SendMessage $tipS 1033 0 $R1
SendMessage $tipS 1025 1 0
SendMessage $tipS 1041 1 $R1
System::Free $R1
System::Call USER32::LoadCursor(i,i32649)i.s
System::Call USER32::SetCursor(is)
${Else}
SendMessage $tipS 1025 0 0
${EndIf}
FunctionEnd
what i am doing wrong ?
Afrow UK
8th April 2013 11:46 UTC
You have spaces in your API call string therefore you need to surround it with quotes or remove the spaces as you have done with your other calls.
Stu
sss123next
8th April 2013 20:38 UTC
oh..., thx! i will check it now.
sss123next
8th April 2013 22:28 UTC
you right, but now i have another problem, function always returns 0, i have tried to pass $hwndparent and also $our_btn with window handle, but i always have 0, i understand what it is winapi question and not nsis, but maybe you can help me ?
Afrow UK
9th April 2013 11:26 UTC
ChildWindowFromPointEx expects 3 arguments, the 2nd of which is a POINT struct. You should be passing it ir0 for the 2nd argument (and then freeing $0).
Stu
sss123next
9th April 2013 16:26 UTC
i will try, but WindowFromPoint expect one argument, point struct as well, so i write code based on this call, i will check with struct and reply.
sss123next
9th April 2013 17:39 UTC
same result, returning 0 (, but thx for your help anyway.
Anders
9th April 2013 18:22 UTC
Msdn:
the search is restricted to immediate child windows. Grandchildren and deeper descendants are not searched
See also:
http://blogs.msdn.com/b/oldnewthing/.../10110077.aspx
sss123next
10th April 2013 11:25 UTC
thx for link, interesting post, but, my problem is what functions return 0, not parent, but 0, i have tried $hwndparent, which as i understand root nsis window, i also tried handle of window on which i need to detect mouse as parent handle, but in all tries i have 0 as result, so looks like functions just noop, all except WindowFromPoint which is not work for transparent/disabled/..e.t.c., and i failing to understand what i am doing wrong, i also tried to pass struct as Afrow Uk and System plugin manual recommends, but with same result.
i know handle of windows which i need to detect from point, so i can pass it as parent, and i tried that, but not work as well.
maybe this api calls needs some special initializations before using ?