Change algorithm of the finding window under cursor

This commit is contained in:
abs62 2011-03-29 18:45:32 +04:00
parent 5cd8416ceb
commit f7d7920e68

View file

@ -12,6 +12,16 @@ UINT_PTR TimerID = 0;
typedef void (*GetWordProc_t)(TCurrentMode *); typedef void (*GetWordProc_t)(TCurrentMode *);
GetWordProc_t GetWordProc = NULL; GetWordProc_t GetWordProc = NULL;
static HWND GetWindowFromPoint(POINT pt) {
HWND WndParent,WndChild;
WndParent = WindowFromPoint(pt);
if(WndParent == NULL) return WndParent;
ScreenToClient(WndParent, &pt);
WndChild=RealChildWindowFromPoint(WndParent, pt);
if(WndChild == NULL) return WndParent;
return WndChild;
};
static void SendWordToServer() static void SendWordToServer()
{ {
if (hGetWordLib == 0) { if (hGetWordLib == 0) {
@ -40,7 +50,7 @@ DWORD wso;
wso = WaitForSingleObject(hSynhroMutex, 0); wso = WaitForSingleObject(hSynhroMutex, 0);
if (wso == WAIT_OBJECT_0 || wso == WAIT_ABANDONED) { if (wso == WAIT_OBJECT_0 || wso == WAIT_ABANDONED) {
KillTimer(0, nTimerid); KillTimer(0, nTimerid);
if ((GlobalData->LastWND!=0)&&(GlobalData->LastWND == WindowFromPoint(GlobalData->LastPt))) { if ((GlobalData->LastWND!=0)&&(GlobalData->LastWND == GetWindowFromPoint(GlobalData->LastPt))) {
SendWordToServer(); SendWordToServer();
} }
ReleaseMutex(hSynhroMutex); ReleaseMutex(hSynhroMutex);
@ -56,7 +66,7 @@ DWORD wso;
HWND WND; HWND WND;
TCHAR wClassName[64]; TCHAR wClassName[64];
WND = WindowFromPoint(((PMOUSEHOOKSTRUCT)lParam)->pt); WND = GetWindowFromPoint(((PMOUSEHOOKSTRUCT)lParam)->pt);
if(WND == NULL) { if(WND == NULL) {
ReleaseMutex(hSynhroMutex); ReleaseMutex(hSynhroMutex);