SS_NOTIFY and WM_SETCURSOR
Hi All,
I'm trying to imitate a hyperlink on a dialog using C++.
I'm using a static control with SS_NOTIFY set so that a user can click the control and go to a webpage.
Code:
CONTROL "http://google.co.uk",IDC_STC_URL,"Static",WS_CHILD|WS_VISIBLE|SS_NOTIFY|SS_CENTER,3,75,78,12
With SS_NOTIFY set I can intercept the click, as it's registered against the static:
Code:
case IDC_STC_URL:
ShellExecute(NULL, "open", "http://google.co.uk", NULL, NULL, SW_SHOWNORMAL);
return TRUE;
I'm also changing the cursor to a hand by intercepting the WM_SETCURSOR message:
Code:
case WM_SETCURSOR:
POINT pt;
RECT rect;
GetCursorPos( &pt );
GetWindowRect( GetDlgItem(hwnd,IDC_STC_URL), &rect );
if (PtInRect(&rect, pt))
{
SetCursor(LoadCursor(NULL, IDC_HAND));
}
else
{
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
return TRUE;
However, when SS_NOTIFY is set the cursor change doesn't work. When SS_NOTIFY is disabeled it does. But then the click isn't registered against the static so ShellExecute() doesn't get to open the URL.
Does anyone have a suggestion as to what I'm doing wrong?
Thanks,
Dave