From: Zhaoyi zhaoyi@uniontech.com
Add a check condition for whether the type is slLink.
Signed-off-by: Zhaoyi zhaoyi@uniontech.com --- dlls/comctl32/syslink.c | 3 ++- dlls/comctl32/tests/syslink.c | 46 ++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index 8130bf19641..5302b95dccb 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -1329,7 +1329,8 @@ static PDOC_ITEM SYSLINK_LinkAtPt (const SYSLINK_INFO *infoPtr, const POINT *pt, } return Current; } - id++; + if (Current->Type == slLink) + id++; }
return NULL; diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index d5192c26b5c..234bfa8653a 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -30,6 +30,7 @@ #define SYSLINK_SEQ_INDEX 1
static HWND hWndParent; +static int g_linkid;
static struct msg_sequence *sequences[NUM_MSG_SEQUENCE];
@@ -100,7 +101,23 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP }
defwndproc_counter++; - ret = DefWindowProcW(hwnd, message, wParam, lParam); + switch(message) + { + case WM_NOTIFY: + { + NMLINK *nml = ((NMLINK*)lParam); + if (nml && NM_CLICK == nml->hdr.code) + { + g_linkid = nml->item.iLink ; + } + + /* Return zero to indicate default processing */ + return 0; + } + + default: + ret = DefWindowProcW(hwnd, message, wParam, lParam); + } defwndproc_counter--;
return ret; @@ -131,7 +148,7 @@ static HWND create_parent_window(void) return CreateWindowExW(0, L"Syslink test parent class", L"Syslink test parent window", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE, - 0, 0, 200, 100, GetDesktopWindow(), + 0, 0, 490, 160, GetDesktopWindow(), NULL, GetModuleHandleW(NULL), NULL); }
@@ -162,8 +179,8 @@ static HWND create_syslink(DWORD style, HWND parent) HWND hWndSysLink;
/* Only Unicode will do here */ - hWndSysLink = CreateWindowExW(0, WC_LINK, L"Head <a href="link1">Name1</a> Middle <a href="link2">Name2</a> Tail", - style, 0, 0, 150, 50, + hWndSysLink = CreateWindowExW(0, WC_LINK, L"Head <a href="link1">Name1</a> Middle <a href="link2">Name2</a> Middle <a href="link3">Name3</a> Tail", + style, 0, 0, 354, 20, parent, NULL, GetModuleHandleW(NULL), NULL); if (!hWndSysLink) return NULL;
@@ -238,6 +255,26 @@ static void test_LM_GETIDEALSIZE(void) DestroyWindow(hwnd); }
+static void test_GETSYSLINKID(void) +{ + HWND hwnd; + int point; + + hwnd = create_syslink(WS_CHILD | WS_TABSTOP | WS_VISIBLE, hWndParent); + ok(hwnd != NULL, "Failed to create SysLink window.\n"); + + //the test point of link3(x=260 y=10). + point = ((10 << 16) | 260); + + SendMessageA(hwnd, WM_LBUTTONDOWN, 1, (LPARAM)point); + + g_linkid = 0; + SendMessageA(hwnd, WM_LBUTTONUP, 0, (LPARAM)point); + ok(g_linkid == 2, "GETSYSLINKID was not processed correctly!\n"); + + DestroyWindow(hwnd); +} + START_TEST(syslink) { ULONG_PTR ctx_cookie; @@ -266,6 +303,7 @@ START_TEST(syslink) test_create_syslink(); test_LM_GETIDEALHEIGHT(); test_LM_GETIDEALSIZE(); + test_GETSYSLINKID();
DestroyWindow(hWndParent); unload_v6_module(ctx_cookie, hCtx);