mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Change algorithm of the finding window under cursor
This commit is contained in:
parent
5cd8416ceb
commit
f7d7920e68
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue