> PP has now a built-in keywords, xcursor/ycursor. I thought they're
> using GetCaretPos. BTW, GetCaretPos returns the client coordinate,
> maybe you forgot to convert it to the screen coordinate.
They are using attachthreadinput. I did go back and recheck
clienttoscreen stuff and I think I was doing it wrong -- for some
reason I was using the parent window?? The attached seems better on
initial testing.
Here is the code. Note that PowerPro may have to switch back to the
correct foreground window so the routine is also passed the handle
of the "real" foreground window. Note it defaults to mouse pos if
problems.
void GetCaretPosScreen(HWND h,POINT *pt)
{
HWND hfocus,hp,hh;
RECT rc;
DWORD tid2;
BOOL res;
DWORD tidme=GetCurrentThreadId();
HWND hfore=GetForegroundWindow();
if (!h)
h=hfore;
else if (hfore!=h)
{
MySetForegroundWindow(h);
Sleep(30);
}
tid2=GetWindowThreadProcessId(h,NULL);
if (tid2==tidme)
{
hfocus=GetFocus();
res=GetCaretPos(pt);
}
else
{
AttachThreadInput(tidme, tid2, TRUE);
hfocus=GetFocus();
res=GetCaretPos(pt);
AttachThreadInput(tidme, tid2, FALSE);
}
GetWindowRect(hfocus, &rc);
if (res&&hfocus )
{
hp=hfocus;
ClientToScreen(hp,pt);
if (! PtInRect( &rc,*pt))
GetCursorPos(pt);
}
else
{
GetCursorPos(pt);
}
if (hfore!=h)
MySetForegroundWindow(hfore);
}
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/power-pro/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/